2.2.1.2 r2m

Brief Information

Convert range of worksheet cells to matrix

Command Line Usage

1. r2m irng:=[Book1]Sheet1!Col(1)[1]:Col(4)[5]

2. r2m irng:=[Book1]Sheet1!Col(1)[1]:Col(4)[5] om:=[MBook1]MSheet1!Mat(1)

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 input data range

Data Format xy

Input

int

noxy
Specify the X and Y coordinates

Option list:

  • xcol:X across columns
0. Specify that the X coordinates will be from row values of the source input data, across the columns.
  • ycol:Y across columns
1. Specify that the Y coordinates will be from row values of the source input data, across the columns.
  • noxy:No X and Y
2. Directly the specifies input data range without specifying X and Y coordinates. X and Y coordinates will be integer values.
X Values in xlabel

Input

int

Available when X across columns is selected from Data Format. It can be the input data first data row or a column label row.

Option list:

  • none:None
Use matrix column indices as X coordinates.
  • row1:First Row in Selection
Use the values of the first data row as X coordinates.
  • param:Column Label
Use the values of a column label row as X coordinates.
Y Values in First Column ycol

Input

int

0
Available when X across columns is selected from Data Format. Check to use the first column values as Y coordinates.
Y Values in ylabel

Input

int

Available when Y across columns is selected from Data Format. It can be the input data first data row or a column label row.

Option list:

  • none:None
Use matrix row indices as Y coordinates.
  • row1:First Row in Selection
Use the values of the first data row as Y coordinates.
  • param:Column Label
Use the values of a column label row as Y coordinates.
X Values in First Column xcol

Input

int

0
Available when Y across columns is selected from Data Format. Check to use the first column values as X coordinates.
Column Label param

Input

string

This is only available when Column Label is selected from X Values in or Y Values in. Specify the label row to use as the X or Y coordinates using its Label Row character. Please refer to Column Label Row Characters for the single character of each column label row.
Even Spacing Relative Tolerance(%) tol

Input

double

5
Tolerance used to check for even spacing.
Use Linear Fit Estimate for Coordinates lr

Input

int

0
This checkbox specifies whether or not to use linear fit estimate for coordinates.
Trim Missing trim

Input

int

1
Determine whether to trim the missing rows or columns
Output Matrix om

Output

MatrixObject

<new>

Specifies output matrix

See the syntax here.

Description

This function converts a range of worksheet data into matrix directly, and assigns the matrix coordinates automatically. More information about worksheet to matrix conversion, please refer to the help of w2m X-Function.

Examples

  • Run from the Command window

1. Import the file \Samples\Matrix Conversion and Gridding\DirectXY.dat.

2. Type the following script in command window: r2m irng:=!Col(1)[1]:Col(4)[5];

After you executed the script, the appointed range of worksheet data was converted into matrix directly.

  • Code Sample
/*
This example shows how convert worksheet range data into matrix.
The sample data is exe_path\Samples\Matrix Conversion and Gridding\DirectXY.dat.
1. Load data to a new created workbook.
2. Convert worksheet range into matrix.
*/
// Get sample file name
fn$ = system.path.program$ + "Samples\Matrix Conversion and Gridding\DirectXY.dat";
// New a workbook
newbook;
// Import data to active worksheet
impASC fn$;

// Convert worksheet range into matrix
r2m irng:=!Col(2)[2]:Col(5)[6];

Related X-Functions

m2v, w2m, wexpand2m


Keywords:direct, xyz, expand, gridding