220.127.116.11 Converting Matrix to Worksheet
You may need to re-organize your data by converting from matrix to worksheet, or vice versa, for certain analysis or graphing needs. This page provides information and examples of converting matrix to worksheet, and please refer to Converting Worksheet to Matrix for the "vice versa" case.
Matrix to Worksheet
Data in a matrix can also be converted to a worksheet by using the m2w X-Function. This X-Function can directly convert data into worksheet, with or without X/Y mapping, or convert data by rearranging the values into XYZ columns in the worksheet.
The following example shows how to convert matrix into worksheet, and plot graphs using different methods according the form of the worksheet data.
// Create a new matrixbook
win -t matrix;
// Set matrix dimension and X/Y values
mdim cols:=21 rows:=21 x1:=0 x2:=10 y1:=0 y2:=100;
// Show matrix X/Y values
page.cntrl = 2;
// Set matrix Z values
msetvalue formula:="nlf_Gauss2D(x, y, 0, 1, 5, 2, 50, 20)";
// Hold the matrix window name
%P = %H;
// Covert matrix to worksheet by Dierct method
m2w ycol:=1 xlabel:=row1;
// Plot graph from worksheet using Virtual Matrix
plotvm irng:=1! format:=1 ztitle:=MyGraph type:=242 ogl:=<new template:=cmap>;
// Convert matrix to XYZ worksheet data
sec -p 2;
win -a %P;
m2w im:=!1 method:=xyz;
// Plot a 3D Scatter
worksheet -s 3;
worksheet -p 240 3D;
If the matrix data is converted directly to worksheet cells, you can then plot such worksheet data using the Virtual Matrix feature.