Copy a single column, row, or entire matrix to a worksheet column
1. m2v im:=[Mbook1]MSheet1!mat(1); // Transfer the first row of a matrix to a worksheet column.
2. m2v method:=m2v direction:=col; // Transfer the whole matrix to a worksheet column. Append by column.
3. m2v method:=row2v ox:=[book1]Sheet1!col(2); // Transfer the first row of a matrix to a specified column.
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Input Matrix | im |
Input MatrixObject |
|
Specifies the input matrix. The default is the active matrix object. |
Method | method |
Input int |
|
Specifies method to convert the matrix.
|
Index of Column/Row | index |
Input int |
|
This variable is available only when Method is either Copy a Column to Vector or Copy a Row to Vector. It specifies the index of the column/row that will be copied to a vector. |
Direction | direction |
Input int |
|
This variable is available only when Method is Copy all Matrix to Vector. It specifies the direction for copying the matrix elements.
|
Output | ox |
Output vector |
|
Specifies the output vector. |
This X-Function converts a matrix or part of a matrix to a vector.
This example unwraps a matrix and outputs it into a column in worksheet:
// Create a matrix newbook mat:=1; // fill the matrix cell with random numbers matrix -v rnd(); // convert the matrix into a vector and output to a column m2v method:=m2v ox:=[<new>]Sheet1!col(1);
Keywords:convert, vector