I can see that there is an intrinsic function Sum, which computes the sum of the first elements in a column, from row 1 to row i. Is there also an intrinsic function to compute the sum of the elements starting from row N to row M? If there is no such an intrinsic function, how to create it without going deep into programming?
Thank you!
5 L A T E S T R E P L I E S (Newest First)
memph
Posted - 08/17/2009 : 09:47:57 AM
quote:Originally posted by greg
The upper (old) part of the Set Column Values dialog only accepts an expression that returns a value as it loops over the row range designated by 'From' and 'To'. The lower (new in Origin 8) part of the dialog - 'Before Formula Scripts' - can run anything you care to code and in some cases may be the only part of the dialog you will use.
It's not clear what you are trying to accomplish in Set Column Values, but here is an example that finds the mean of every four rows of values in column 1 and places the results in column 2 :
The entire script resides in the "Before Formula Script" section and the expression section is empty.
Hi Greg
I need to find the mean of 5 numbers in col(1) and put the result in col(2), row(1). Then find the mean of the next 5 numbers in col(1) and place the result in col(2), row(2). I tried your method, but I can't make it work. If I don't put anything in th expression section, nothing is happening.
Also I need to take the deviation from the mean and put in col(3).
Do you if this is possible?
Thanks, Kaola
qwertqqq
Posted - 01/23/2009 : 10:51:06 AM I see. Thank you
greg
Posted - 01/23/2009 : 09:15:04 AM The upper (old) part of the Set Column Values dialog only accepts an expression that returns a value as it loops over the row range designated by 'From' and 'To'. The lower (new in Origin 8) part of the dialog - 'Before Formula Scripts' - can run anything you care to code and in some cases may be the only part of the dialog you will use.
It's not clear what you are trying to accomplish in Set Column Values, but here is an example that finds the mean of every four rows of values in column 1 and places the results in column 2 :
The entire script resides in the "Before Formula Script" section and the expression section is empty.
qwertqqq
Posted - 01/23/2009 : 03:50:54 AM
quote:Originally posted by cpyang
You can declare a range variable with the specified rows and use sum, like
int i1 = 2;
int i2 = 6;
range a=col(a)[$(i1):$(i2)];
sum(a);
sum.min=;
sum.N=;
thanks.
However, I just need to change one worksheet column through the "set column values" dialog. I guess it would be difficult to implement the function that you suggested in this dialog.
cpyang
Posted - 01/22/2009 : 9:27:19 PM You can declare a range variable with the specified rows and use sum, like
int i1 = 2;
int i2 = 6;
range a=col(a)[$(i1):$(i2)];
sum(a);
sum.min=;
sum.N=;