When dealing with large dataset, you may want to reduce data before performing analysis or graphing. There are multiple ways to reduce data in Origin. This post will demonstrate how to reduce rows and columns from GUI and the corresponding LabTalk scripts.
Download Reduce_Rows_Columns.zip to follow the procedures below. Results are kept in Results folder of the opj file.
Go to Folder1 and workbook Nitrite. The data is collected in every 0.01 sec.
First let’s reduce data to around every second. Highlight Col(A) and Col(B), and choose Worksheet: Reduce Rows… menu. Set the settings as following.
After clicking OK, the reduced data are added to new columns.
Right click on Sparklines row in workbook and choose Add or Update Sparklines. Click OK to add sparklines of each column. Comparing column B and D, you can see many peaks are lost in the reduced data.
To preserve peak shapes, we need to keep more data. Just left click the green lock on column C and choose Change Parameters context menu to open the dialog again. Change Delete Rows to 9 and click OK. Now the data is reduced to every 0.1 second. The sparklines of column C and D are updated and show a better data reduction.
Reduce Rows in Origin is based on X-Function wreducerows. To see the script behind it, left click the green lock
on column C and choose Generate Script context menu. The script is dumped into Script Window. You can use the script in the future to do such data reduction.
There are other Reduce Methods, e.g. Reduce N rows with merged values: mean, min, max, etc.
Similarly we have Reduce Columns dialog to reduce data column wise. Look at Sensor workbook in Folder1. There are many 3 XY pairs of data for each sensor. All X columns are the same.
If you want to remove all duplicated X columns and get the average Y values for each sensor,you need to use the Reduce Columns dialog twice.
First, delete every other column starting from the 3rd column to remove all duplicated X columns. See the images below.
Then with the new worksheet active, open the Reduce Columns dialog again to merge every 3 Y columns by averaging. See the images below.
You can also run following scripts to run reduce columns twice without opening dialog.
wreducecols start:=3 ow:=<new>; //delete every other column first 3rd column on
wreducecols method:=merge ncols:=3 merge:=ave start:=2 ow:=<new>; //merge every 3 columns by averaging, starting from 2nd column on
From the dialog, you can click the arrow next to Dialog Theme anytime to generate script based on your current settings .