T O P I C R E V I E W |
Marin Vojkovic |
Posted - 10/30/2013 : 09:36:18 AM Origin Ver. and Service Release (Select Help-->About Origin): v7.0552(B552) Operating System: Windows XP
How to divide all the columns in a worksheet by the max value of each column? This is what I have so far:
win -a LID; //make the worksheet active
loop(ii, 2, 45) //looping trough columns {
mc=max(wcol(ii)); // max of the column
LIDnorm_[ii] = wcol(ii)/mc; //this is the part I'm unsure of... }
so, how do I get it to write the new data to columns on the new worksheet (LIDnorm)?
Thank you in advance for any help with this. |
3 L A T E S T R E P L I E S (Newest First) |
greg |
Posted - 10/31/2013 : 09:11:07 AM This should do it:
loop(ii,2,wks.ncols) { sum(wcol(ii)); dMax = sum.max; wo -s ii 0 ii 0; %C/dMax; }
|
Marin Vojkovic |
Posted - 10/30/2013 : 10:15:49 AM nope... it just puts 1 everywhere, except in the cells where the value was 0 - it makes them blank.
I would like 0 to stay 0, and everything else in the column to be divided by the max of the column.
|
greg |
Posted - 10/30/2013 : 09:48:55 AM This works in most versions of Origin:
loop(ii,2,wks.ncols) { wcol(ii) /= max(wcol(ii)); }
Not sure about version 7's handling of vector division .. |
|
|