2.2.26 reducerows

Brief Information

Reduce worksheet by stats on every n rows

Additional Information

Minimum Origin Version Required: 8.1 SR0

Command Line Usage

reducerows npts:=3 method:=first

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input irng

Input

Range

<active>
Specifies the input data range.
Number of Points npts

Input

int

5
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

0
Specifies the value with into a group of data points are merged.

Option list:

  • first:First Point
    Replaces N data points with the first value in the group.
  • last:Last Point
    Replaces N data points with the last value in the group.
  • ave:Average
    Replaces N data points with the average of the group.
  • min:Min
    Replaces N data points with the minimum of the group.
  • max:Max
    Replaces N data points with the maximum of the group.
  • sum:Sum
    Replaces N data points with the sum of the group.
  • sd:SD
    Replaces N data points with the standard deviation of the group.
Output rd

Output

ReportData

[<input>]<new>
Specifies the output range.

Description

The reducerows X-Function replaces every N rows with basic statistics data.

Examples

  • Code Sample
/*
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>;

Related X-Functions

stats, reducexy, reducedup


Keywords:data reduction, average, mean, sum, minimum, maximum, statistics