Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
Yefim Bronfman
Posted - 07/05/2007 : 11:03:00 AM I wrote a simple script to automate a task in origin, but the script fails after the first few columns. I'm rather confused.
The data looks like this: x1 y1 x2 y2 x3 y3 ...... col(45) 1 2 3 ... 3600
*not every column goes down to 3000 column 45 is special, in that it's a place to hold some values. for(i=2;i<45;i+2){ max = -100; for(j=1;j<3600;j++){ if(col($(i))[j]>max){ max = col($(i))[j]; } } col($(i)) /= max; col($(i)) = 1 - col($(i)); integrate col($(i)); col(45)[i/2] = integ.area; }
The preceeding code works for the first 10y columns, but then it stops working until the last column. There is a total of 44 columns, x and y alternatingly.
Please help me debug it, thanks.
1 L A T E S T R E P L I E S (Newest First)
Mike Buess
Posted - 07/05/2007 : 12:11:45 PM I suspect we'll need to see the worksheet before we can supply an answer. However, in the mean time I can give you a much faster way to obtain the maximum value of a column. Furthermore, it's independent of the number of rows in the column...