Download LabTalk Script Guide

Transcript
8.2 Worksheets
// Create a new workbook
newbook;
// Import sample data
string fname$ = system.path.program$ +
"\samples\Matrix Conversion and Gridding\DirectXY.dat";
impasc;
// Covert worksheet to matrix, first row will be X and first column will be Y
w2m xy:=xcol xlabel:=row1 ycol:=1;
// Show X/Y values in the matrix window
page.cntrl = 2;
When your worksheet data is organized in XYZ column form, you should use Gridding to
convert such data into a matrix. Many gridding methods are available, which will interpolate
your source data and generate a uniformly spaced array of values with the X and Y dimensions
specified by you.
The following example converts XYZ worksheet data by Renka-Cline gridding method, and
then creates a 3D graph from the new matrix.
// Create a new workbook without sheets
newbook;
// Import sample data
string fname$ = system.path.program$ +
"\samples\Matrix Conversion and Gridding\XYZ Random Gaussian.dat";
impasc;
// Convert worksheet data into a 20 x 20 matrix by Renka-Cline gridding method
xyz_renka 3 20 20;
// Plot a 3D color map graph
worksheet -p 242 cmap;
8.2.4
Virtual Matrix
Data arranged in a group of worksheet cells can be treated as a matrix and various plots such
as 3D Surface, 3D Bars, and Contour can be created from such data. This feature is referred to
as Virtual Matrix. The X and Y coordinate values can be optionally contained in the block of
data in the first column and row, or also in a header row of the worksheet.
Whereas Matrix objects in Origin only support linear mapping of X and Y coordinates, a virtual
matrix supports nonlinear or unevenly spaced coordinates for X and Y.
The virtual matrix is defined when data in the worksheet is used to create a plot. The plotvm XFunction should be used to create plots.
The following example shows how to use the plot_vm X-Function:
// Create a new workbook and import sample data
newbook;
string fname$=system.path.program$ + "Samples\Graphing\VSurface 1.dat";
impasc;
// Treat entire sheet as a Virtual Matrix and create a colormap surface plot
160
Workbooks Worksheets and Worksheet Columns