The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 Maximum

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
pandapo Posted - 07/19/2011 : 07:44:02 AM
Hi!
I have two columns one with time and one with my values, I would calculate the maximum of the column with my values and have in output the maximum and the corresponding time. Someone knows how to do it?
14   L A T E S T    R E P L I E S    (Newest First)
pandapo Posted - 07/21/2011 : 05:23:39 AM
anyway.. it is fine in this way..thank you a lot! :)
pandapo Posted - 07/21/2011 : 04:21:26 AM
Hi!
now it gives me the the maximum and the corresponding time for each channel, but each channel is placed in another worksheet. I would like to have, if it is possible, all channels with maximum and corresponding time in one tab. Do you know if it is possible?

Hideo Fujii Posted - 07/20/2011 : 3:28:20 PM
Hi,

Probably you have overlooked other worksheet tabs by not scrolling to left using the triangle buttons at the bottom of the workbook. Or, not?

--Hideo Fujii
OriginLab
pandapo Posted - 07/20/2011 : 11:43:57 AM
it gaves me back just the maximum value of the last column with the corresponding time :(
Hideo Fujii Posted - 07/20/2011 : 11:30:51 AM
Hi,

This script is a self-contained, and as I wrote, you need to copy-and-paste to the
Script window ("Window: Script Window" menu), highlight ALL lines, then press ENTER key to run.

--Hideo Fujii
OriginLab
pandapo Posted - 07/20/2011 : 04:50:41 AM
Hi Hideo,
I did:
-open worksheet---> extract worksheet data ---->Scripts-->

%A=%H; //book1
%L=layer.name$; //myworksheet
nc=wks.ncols; //col(c)
for(ii=2;ii<=nc;ii++) {
range B=[%A]%L!col($(ii));
sum(B);
wextract iy:=[%A]%L!(1:end) settings.stAlias.Cols:=$(ii) settings.stAlias.AliasNames:=BB$(ii) settings.stCondition.Condition:="BB$(ii)=sum.max" settings.stMethod.Method:=1 settings.Cols:="0|$(ii-1)";
wcol(2)[C]$=From Col$(ii);
};


in the window Script before select data loop

Then in the 'if' window I wrote:
B=sum.max

I selelcted all the columns from left to right and then Apply.

It doesn't work :(
Hideo Fujii Posted - 07/19/2011 : 2:50:01 PM
Hi pandapo, 

Well... because you said you have two columns, so that is what I 
intended. If you want to apply the same thing to bunch of columns 
repeatedly, you need to have some sort of automitization. 

For example, the following script applies "wextract" command (see 
"Help:X-Functions" help for details) to every column after the second 
column to the rest. You can copy-and-paste to the Script window, 
highlight all lines, then press ENTER key to run: 

%A=%H; //book name
%L=layer.name$; //sheet name
nc=wks.ncols; //colums
for(ii=2;ii<=nc;ii++) {
  range B=[%A]%L!col($(ii));
  sum(B);
  wextract iy:=[%A]%L!(1:end) settings.stAlias.Cols:=$(ii) settings.stAlias.AliasNames:=BB$(ii) settings.stCondition.Condition:="BB$(ii)=sum.max" settings.stMethod.Method:=1 settings.Cols:="0|$(ii-1)";
  wcol(2)[C]$=From Col$(ii);
};

Hope this works!
pandapo Posted - 07/19/2011 : 11:47:45 AM
oh! you are right!

It seems to work just with the first column :(

so my first column is the time (T), the second is B, and then many C ( C1, C2...); I would search the maximum of each column and the corresponding time;
what the script does now, is to search the maximum of the column B, give the time corresponding of the maximum and then give me back also all the other columns' values at that time :(
Hideo Fujii Posted - 07/19/2011 : 11:25:04 AM
Hi,

quote:
Originally posted by pandapo

I cannot find this worksheet query :(



Before Origin 8.5, the menu was called "Extract Worksheet Data".
From next time when you post, as a general manner, please write your Origin version.

Thank you.

--Hideo Fujii
OriginLab
pandapo Posted - 07/19/2011 : 11:19:43 AM
I have Origin 8.1
pandapo Posted - 07/19/2011 : 11:11:53 AM
I cannot find this worksheet query :(
Hideo Fujii Posted - 07/19/2011 : 10:48:52 AM
Hi,

If you don't know the column number, you can use the column name 
instead of the column number in the "range" declaration such that:

  range BB=col(B);
  sum(BB); 

--Hideo Fujii
OriginLab
pandapo Posted - 07/19/2011 : 10:35:14 AM
and if I want to do it for a template file, with an unknown number of columns?
Hideo Fujii Posted - 07/19/2011 : 10:14:59 AM
Hi pandapo,

There may be a smarter way, but the following is one method: 

1) In Script window, type the following two commands (press ENTER at each command):
  range BB=2;
  sum(BB);
Here, "2" in the first line indicates the column number.

2)Choose "Worksheet: Worksheet Query" menu, select and move(=>) the 
all target columns to right panel (the 2nd column got the alias "B"), 
and enter the following condition:
  B=sum.max
and run it.

Hope this works for you.

--Hideo Fujii
OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000