Author |
Topic |
|
LabTalk user
USA
35 Posts |
Posted - 07/22/2011 : 10:50:44 AM
|
Origin Ver. and Service Release (Select Help-->About Origin): 8.1 SR3 Operating System: Win XP SP3
Hello,
I am using the rowstats x-function to calculate the mean and sum of hundreds of rows of data. I can't generate a new column for every row as that is way to many columns, so I've created a column for all the means and one for all the sums. Except when I write values into this column they come out as "--". I noticed the output is in a vector form. I'm not really sure what that means or how to work with these vectors. I know I'm missing something, but I'm clueless as to what. Any help would be appreciated.
Thank you,
Patrick |
|
Penn
China
644 Posts |
Posted - 07/25/2011 : 11:55:50 PM
|
Hi Patrick,
For the vector, you can just specify a column. For example, the following line will calculate the statistics from row 1 to row 32, and the mean and sum will put to column G and column H respectively.
rowstats irng:=col(1)[1]:col(F)[32] mean:=col(G) sum:=col(H);
If there is no columns for the result mean and sum, you can create first, or specify <new> to generate automatically, for example:
rowstats irng:=col(1)[1]:col(F)[32] mean:=<new> sum:=<new>;
For more details, please refer to rowstats.
Penn |
|
|
LabTalk user
USA
35 Posts |
Posted - 07/26/2011 : 09:14:32 AM
|
Penn,
I didn't think of putting the column directly into the X-function. It works great except for one minor problem. When I loop through each row it only displays the last row once the loop has completed. Every cell above is filled with "--". Is there a way to put the mean or the sum vector into a double variable so it can be written into the appropriate cell?
I noticed in the variable list the variables holding the output sum and mean and standard deviation are declared as loose datasets. How can I get the one number I need out of the loose dataset and into a double variable?
Thanks, Patrick |
|
|
Penn
China
644 Posts |
Posted - 07/27/2011 : 05:04:08 AM
|
Hi Patrick,
Maybe you can use dataset variable in rowstats for sum and mean. For example:
dataset dsMean; // declare dataset
dataset dsSum;
rowstats irng:=col(1)[1]:col(F)[32] mean:=dsMean sum:=dsSum;
double mean1 = dsMean[1]; // get first mean
double sum1 = dsSum[1]; // get first sum
Penn |
|
|
LabTalk user
USA
35 Posts |
Posted - 07/27/2011 : 09:08:08 AM
|
Penn,
That works beautifully. I didn't know datasets had elements similar to arrays. That is useful to know. Thank you for the prompt reply and the assistance.
Patrick |
|
|
craiggarvin
USA
1 Posts |
Posted - 03/11/2014 : 2:28:21 PM
|
How do I apply 'rowstats' only to the rows that have been selected by a prior filtering operation? I assume I define the range to only include rows with visiblerows=1, but can't figure out how to do this. Any help would be greatly appreciated. |
|
|
greg
USA
1378 Posts |
Posted - 03/14/2014 : 12:56:41 PM
|
There is a reminder message box which determines whether to include or exclude hidden rows from analysis. You can tell Origin to permanently behave one way or the other, but if you have done this there is still an option you can set in the worksheet... With your worksheet active, press F4 to bring up Worksheet Properties. On the Miscellaneous tab is the check box to "Ignore Hidden Rows on Plotting and Analysis". Note that if you look at this dialog before creating a filter on your sheet AND you have previously told Origin to behave this way and not remind you, then the act of creating a filter will automatically check this box.
So checking the box tells Origin to ignore hidden rows, but there is still a gotcha': If your script (or gui operation) has set Recalculate to Manual or Auto, then any change in which rows are hidden will automatically update previously or newly hidden rows upon recalculation. If you set the Recalculate operation to None and disable the filter, you should see missing values for all rows that were hidden. |
|
|
BPrzybyla
Germany
6 Posts |
Posted - 03/18/2014 : 03:41:31 AM
|
OriginPro 8.1 SR3 (Win7 64bit)
speaking of rowstats X-function...
I have an ordinary worksheet with X, Y-YEr, Y-YEr, Y-YEr, [...] data.
I want the Y-mean per row (maybe including the error as weighting... I'm not that far into statistics yet). Rowstats applies mean over all my Y columns including YEr.
Best regards
B. Przybyla |
|
|
|
Topic |
|