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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Maximum for multiple datasets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Wellsyfred

Australia
2 Posts

Posted - 10/03/2014 :  12:48:29 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I have multiple large datasets and am trying to programmatically find the maximum of each.

For example, if I had the data:

X Y1 Y2 Y3
1 2 7 3
2 43 65 23
3 44 34 60


I would want it to return 44, 65, 60

Additionally, I would like to find the X values corresponding to these maximum values. For my example these would be 3, 2, 3.

I have tried using max(Col(A1)) and inserting each column manually, which works fine, but would be painstaking to type out for hundreds of columns...

Origin Ver. 8.6, Windows 7


Thanks so much!

greg

USA
1378 Posts

Posted - 10/03/2014 :  09:13:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Right-click on the Title Bar of your Workbook and choose "Show Script Panel".
In the lower panel, paste the following script:
// BEGIN SCRIPT
wks.userparam1$ = Max;
wks.userparam1 = 1;
wks.userparam2$ = at X;
wks.userparam2 = 1;
loop(ii,2,wks.ncols)
{
limit wcol(ii);
wcol(ii)[Max]$ = $(limit.ymax,*5);
wcol(ii)[at X]$ = $(limit.imax);
}
// END SCRIPT
Click the Execute button.
Go to Top of Page

Wellsyfred

Australia
2 Posts

Posted - 10/04/2014 :  01:31:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This worked perfectly!

Thanks so much :)
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000