Author |
Topic  |
|
thomsen01
Austria
22 Posts |
Posted - 04/28/2014 : 09:52:30 AM
|
OriginPro 9.1.0G (32-bit) SR2, Win7
Hello!
How can I get the row number of a median? For example I have a datasheet with 1 column: 2 3 1 6 7 8 3 with the function: db=median(col(1)[1:5],2); db=; I can get the median of the first 5 rows and it's "3", but how can I also get the row number (in this case "2")? Thanks for your help!
Thomsen |
|
lkb0221
China
497 Posts |
|
greg
USA
1379 Posts |
Posted - 04/28/2014 : 3:53:39 PM
|
Without sorting, if you know the median is unique, you can use this:
range raD = [Book1]Sheet1!col(2); MedianRow = list(median(raD,1),rad);
But it's possible the median exists more than once, in which case you can use:
dataset dsIdx; range raD = [Data1]Sheet1!2; MedianValue = median(rad,1); vfind value:=MedianValue ix:=rad ox:=dsIdx; loop(ii,1,dsIdx.GetSize()) { ty $(MedianValue) in row $(dsIdx[ii]); }
Note that only option 1 of the Median function returns a value that is actually found in the data. |
 |
|
thomsen01
Austria
22 Posts |
Posted - 04/30/2014 : 09:26:49 AM
|
Thank you for the answers.
Unfortunately I have no possibility to sort my dataset, but the second solution by greg works fine with a few adjustments.
Thanks for your help.
Thomsen |
 |
|
|
Topic  |
|
|
|