Reduce worksheet by stats on every n rows
Minimum Origin Version Required: 8.1 SR0
reducerows npts:=3 method:=first
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Input | irng |
Input Range |
|
Specifies the input data range. |
Number of Points | npts |
Input int |
|
Specifies a group size : n. Then every n data points in the input range are merged into one data point. |
Merge by | method |
Input int |
|
Specifies the value with into a group of data points are merged.
Option list:
|
Output | rd |
Output ReportData |
|
Specifies the output range. |
The reducerows X-Function replaces every N rows with basic statistics data.
/* Sometimes users may put the data to be averaged into one column, e.g. x1 y1 x1 y2 (...148...) x1 y149 x1 y150 x2 y151 x2 y152 (...148...) x2 y299 x2 y300 x3 y301 etc... The reduce XF can be used to merge the data points that correspond to the same X value. 1. Generate the x column. 2. Put random numbers into y column. 3. Use reduce to merge the data. 4. Plot the original data and result data in the same layer. */ //Create a new workbook and add columns newbook result:=bkname$; worksheet -a 2; wks.col3.type=4; //Generate data for the x column col(1)=data(0, 99); col(1)=int(col(1)/10+1); //Generate random data for the y column col(2)=uniform(100, 1); //Reduce data points reducerows irng:=col(1) npts:=10 rd:=col(3); reducerows irng:=col(2) npts:=10 method:=2 rd:=col(4); //Plot window -t p; //Open an empty graph window plotxy iy:=[bkname$]1!2 plot:=201 ogl:=<active>; plotxy iy:=[bkname$]1!4 plot:=200 ogl:=<active>;
Keywords:data reduction, average, mean, sum, minimum, maximum, statistics