T O P I C R E V I E W |
abreiti |
Posted - 05/04/2010 : 11:34:47 AM 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 |
2 L A T E S T R E P L I E S (Newest First) |
abreiti |
Posted - 05/06/2010 : 10:58:58 AM 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); } } |
greg |
Posted - 05/05/2010 : 4:30:20 PM 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);
|
|
|