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 for Programming
 LabTalk Forum
 Maximum in Worksheet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

abreiti

Germany
Posts

Posted - 05/04/2010 :  11:34:47 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

is there any possibility to find the maximum over all columns in a worksheet.

I need the maximum and the correspondending column number.

Thnaks,

abreiti

greg

USA
1378 Posts

Posted - 05/05/2010 :  4:30:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This should do it:

maxval = -1e300;
maxcol = 0;
loop(ii,1,wks.ncols)
{
val = max(wcol(ii));
if(val > maxval)
{
maxval = val;
maxcol = ii;
}
}
ty Maximum of $(maxval) occurs in column $(maxcol);

Edited by - greg on 05/05/2010 4:30:40 PM
Go to Top of Page

abreiti

Germany
Posts

Posted - 05/06/2010 :  10:58:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank's for the input. It doesn't worked with my Origin 7.5, but with the above information I found a solution that worked very well.

max = 0;
maxCOL = 0;
maxROW = 0;

loop(ii,1,wks.ncols)
{
%n=%h!wks.col$(ii).name$;
%q=%h_%n;
limit %q;
type "max $(LIMIT.YMAX)";
if($(LIMIT.YMAX) >= $(max))
{
max = $(LIMIT.YMAX);
maxCOL = $(ii);
maxROW = $(LIMIT.IMAX);
}
}
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