2.2.3.65 wreducecols

Menu Information

Reduce Columns

Brief Information

Reduce worksheet by merging or deleting columns

Additional Information

Minimum Origin Version Required: 9.1 SR0

Command Line Usage

1. wreducecols method:=merge ncols:=2 merge:=ave start:=3; //From the third column, every two columns merge their data points into the average of them.

2. wreducecols start:=2 end:=9 ow:=[<new>]<new>; //Specify the starting column and end column to delete, and output the result in a new book new sheet.

3. wreducecols -r 1 method:=mergeByLabels labelName:="Long Name" merge:=sum end:=4 ow:=<new>;

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 Worksheet iw

Input

Worksheet

<active>
Specifies the input data range.
Reduce Method method

Input

int

0
Specifies the reduce method.

Option list:

  • 0=del:Delete N columns, then skip M columns
Delete N columns, then skip M columns
  • 1=merge:Reduce N columns with merged values
Merge every N columns into one by specified merge method.
  • 2=mergeByLabels:Merge by Column Labels
Merge columns with same specified column label row into one by specified merge method.
Label Row labelName

Input

string

Available only when method = mergeByLabels. Specify the column label row used to merge columns
Merge/Delete Columns ncols

Input

int

2
Specifies how many columns to merge or delete.
This option is only available when select Delete N columns, then skip M columns or Reduce N columns with merged values as Reduce Method.
Skip Columns skip

Input

int

1
Specifies how many columns to skip.
This option is only available when select Delete N columns, then skip M columns as Reduce Method.
Merge by merge

Input

int

0
Specifies the value to replace the merged data points.
This option is only available when Reduce Method is set to Reduce N columns with merged values or Merge by Column Labels.

Option list:

  • first:First Point
Merges data points into the first data point of these data points.
  • last:Last Point
Merges data points into the last data point of these data points.
  • ave:Average
Merges every N data points into the average of these data points.
  • min:Min
Merges data points into the minimum value of these data points.
  • max:Max
Merges data points into the maximum value of these data points.
  • sum:Sum
Merges data points into the sum of these data points.
  • sd:SD
Merges data points into the standard derivation of these data points.
  • median:Median
Merges data points into the median of these data points.
  • custom:Custom
Merges data points into the specify the values of these data points. You can specify the desired values in the custom variable.
Custom custom

Input

int

ave sd
Available only when the data points are merged by Custom. You can specify multiple values in this variable.
Starting Column to Merge/Delete start

Input

int

1
Specifies the starting column to merge/delete.
End Column to Merge/Delete end

Input

int

-1
Specifies the end column to merge/delete. Script accessible only.
Output Worksheet ow

Output

Worksheet

<input>
Specifies the output worksheet. See the syntax here.

Description

This X-Function is used to delete columns or merge columns with specified statistics data.

Example

  1. Create a new workbook and import the Origin sample data Step01.dat which is located in <Origin Program Folder> \Samples\Curve Fitting.
  2. When the workbook is active, select menu item Worksheet: Reduce Columns to open wreducecols X-Function dialog. Set the options as below:
    Reduce Method: Delete N columns, then skip M columns
    Delete Columns: 1
    Skip Columns: 1
    Starting Columns to Delete: 4
    Output: <new>
  3. Click OK to delete the columns and the result will be output in a new sheet.

Related X-Functions

wreducerows, reducerows, wdelrows


Keywords:data reduction