2.2.1.10 xyz_sparse

Brief Information

Convert XYZ sparse data to matrix

Command Line Usage

1. xyz_sparse iz:=Col(3) rows:=3 cols:=5;

2. xyz_sparse iz:=Col(3) rows:=3 cols:=5 om:=[MyMatrix]Sheet1!Mat(1);

Variables

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

Input

XYZRange

<active>

Specifies the input XYZ range.

Rows rows

Input

int

20

Rows in the output matrix.

Columns cols

Input

int

20

Columns in the output matrix.

Output Matrix om

Output

MatrixObject

<new>

The output matrix.

See the syntax here.

Description

The Sparse XYZ worksheet to matrix conversion is similar to the Regular XYZ conversion (i.e. X and Y data values must be regularly spaced), except that in the case of the Sparse conversion, missing XY pairs are acceptable. Using proper X and Y step setting, sparse method will fill the value in the grid nodes like: After conversion, Origin will generate the following matrix: With the sparse matrix, you can create a 3D plot with Z values plotted only at select XY values, as in this 3D bar plot: Examples

• To run from Command window
1. Import the file \Samples\Matrix Conversion and Gridding\Sparse.dat.
2. Type xyz_sparse iz: = Col(3) rows: = 3 cols: = 5 in the command window.
• Code Sample
/*
This example shows how convert sparse worksheet data into matrix.
The sample data is exe_path\Samples\Matrix Conversion and Gridding\Sparse.dat
1. Load data to a new created workbook.
2. Random xyz gridding by sparse method.
3. Plot 3D bars.
*/

// Get sample data
fn$= system.path.program$ + "Samples\Matrix Conversion and Gridding\Sparse.dat";
newbook;
impASC fn\$;
// Set the third column as Z column
wks.col3.type = 6;

// Convert worksheet data into matrix by sparse gridding method
xyz_sparse iz:=Col(3) rows:=3 cols:=5;

// Plot
worksheet -p 242 3Dbars;

Related X-Functions

Keywords:worksheet