Author |
Topic |
|
johannes.kastl
Germany
71 Posts |
|
johannes.kastl
Germany
71 Posts |
Posted - 08/12/2013 : 09:09:54 AM
|
Christy,
thanks for your answer.
I should have been more clean in my first post. I already know of some ways to get the row statistics. Disadvantage for rowstats is that it can't be automatically recalculated, which is possible by using either "Calculate values" or by using the function in the Statistics-Menu.
I was just wondering why mean() and stddev() do not accept a valid range as input. If there was - an error in my statements or - an error in the description to these functions (and they do not accept all ranges as input) or - a bug in Origin, which leads to this behaviour.
Sorry for the confusion.
Regards, Johannes |
|
|
greg
USA
1378 Posts |
Posted - 08/15/2013 : 4:19:04 PM
|
mean( ), stddev( ), etc. all take vector arguments which means they are limited to a single dimension array, so any range you declare with the intent of passing as an argument to these functions must be to a single column (or dataset) or sub-range of that column.
Origin does not outright reject a multi-column range and instead returns the value for the first column in the range. Odd, but there you have it.
If all you need are mean and SD for a contiguous block of cells, you can use the stats X-Function:
range raMC = 2[10]:6[35]; // Range from column 2 row 10 to column 6 row 35 stats raMC; ty Mean is $(stats.mean) with SD of $(stats.sd);
|
|
|
johannes.kastl
Germany
71 Posts |
|
AlexD2
France
19 Posts |
Posted - 01/12/2014 : 11:45:16 AM
|
One can apparently also use the -v option switch of the range declaration:
range -v rRow = 1[3]:8[3]; // Defines a range (vector type?) rRow // over the 3rd row between columns 1 and 8 mean(rRow)=; // Gives the expected row mean
Not sure how general is this trick though...
If someone can clarify (or give a link) for the subtle difference between e.g. dataset, vector, and range defined with the -v switch, that would be much helpful...
Many thanks,
AlexD2 |
|
|
greg
USA
1378 Posts |
Posted - 01/14/2014 : 4:03:31 PM
|
The -v switch is new in Origin 9.1.
http://wikis/ltwiki/index.php?title=LabTalk%3ARange_Notation#Option_Switch_-vOption_Switches
The range points to data - which need not be contiguous - and then acts like a single dimension array of data stored in column major order.
The range can currently only be used in an X Function where the Input type is vector. Stats is such an X Function, so stats of a row can easily be determined:
row = 7; range -v raRow = 1[row]:end[row]; stats raRow; stats.mean=;
Here is a non-contiguous example: newbook; loop(ii,1,5) { wcol(ii)=data($(ii),$(ii+5)); } range -v raV = (col(1)[1:3],col(3)[2:4],col(5)[3:6]); stats raV; stats.=;
|
|
|
AlexD2
France
19 Posts |
Posted - 01/14/2014 : 4:31:50 PM
|
Beautiful!
Thank you!
AlexD2 |
|
|
|
Topic |
|
|
|