Opening a Matrix Window

The matrix window is similar to a worksheet in that it is used to store and manipulate data. However, in the matrix window, there is an underlying X, Y, Z relationship for each cell. Each column is associated with an X value, and each row is associated with a Y value (though you can reverse these relationships). Each cell thus has three values: one associated with the row, one associated with the column, and the actual value that appears in the cell, which is the Z value.

To open a new matrix, select File:New. This menu command opens the New dialog box. Select Matrix from the Window Type list box. Select Origin from the Template drop-down list. Click OK to open a matrix window based on the ORIGIN.OTM template.

To open a previously saved matrix window, select File:Open. Select 'Matrix (*.OGM)' from the Files of Type drop-down list. Select the desired file and click Open.

Shortcut Menus in the Matrix

Right-click in the following matrix locations to open associated shortcut menus:

· The matrix window title bar.

· The upper-left corner of the matrix window.

· A column or row heading, or any cell or range of cells in the matrix.

· Outside of the matrix grid.

· Any object in the matrix window.

Setting the Matrix Dimensions

To set the matrix dimensions, select Matrix:Set Matrix Dimension. This menu command opens the Matrix Dimension dialog box.

The Matrix Dimension Dialog Box

1) The Internal Data Type Drop-down List

This drop-down list selection sets the maximum size for each matrix value, in bytes. The default data type is Double(8), which allocates eight bytes of storage space to each value. Double is the only data type that supports missing values. The Float(4) data type allocates four bytes of storage space per value. The Integer(2) data type allocates two bytes of storage space per value. The Long(4) data type allocates four bytes of storage space per value. However, the value is stored as an integer.

2) The Number of Columns Text Box

Type the desired number of columns in this text box.

3) The Number of Rows Text Box

Type the desired number of rows in this text box.

Setting the Matrix XY Coordinates

Each column of the matrix has an associated X value, and each row has an associated Y value. Thus, X and Y values are determined by position within the matrix. To set the matrix X and Y coordinates, select Matrix:Set Matrix XY Coordinates. This menu command opens the Map Matrix XY Coordinates dialog box.

The Map Matrix XY Coordinates Dialog Box

1) The X (First Column) Text Box

Type the starting X value in this text box.

2) The X (Last Column) Text Box

Type the maximum X value in this text box.

3) The Y (First Row) Text Box

Type the starting Y value in this text box.

4) The Y (Last Row) Text Box

Type the maximum Y value in this text box.

Setting the Matrix Values

To fill the matrix with Z values, select Matrix:Set Matrix Values. This menu command opens the Set Matrix Values dialog box.

The Set Matrix Values Dialog Box

1) Select the Matrix Column and Row Range

The initial and final cells in the selection range are indicated by column and row number (i) in the associated 'from' and 'to' text boxes. Enter new values to change the selection range. Matrix values are only entered in the cells that fall within the selection range.

2) Enter a Formula

The formula in the text box is used to fill the selected matrix cells with values. The formula can include any mathematical expression recognized by Origin. If you enter an expression and close the dialog box but nothing happens, make sure you selected a range in the 'from' and 'to' text boxes.

Note: Do not include a semicolon after the expression entered in the Set Matrix Values dialog box.

3) The Do It Button

Click this button to set values for the matrix according to the specified formula.

4) The Update Button

Click this button to set the specified formula as the default formula for the active matrix window. Each matrix window can be associated with a different formula. Matrix formula are retained when you create a matrix template.

5) The Cut Button

Click this button to delete the selected text in the current formula and place it in the Clipboard.

6) The Copy Button

Click this button to copy the selected text in the current formula to the Clipboard.

7) The Paste Button

Click this button to replace the selected text in the formula with the current Clipboard contents.

8) The Undo Button

Click this button to undo the last change made to the current formula.

More:

Viewing the Matrix Values

Viewing the Matrix Values

Use the scroll bars on the right and bottom edges of the matrix window to view the desired cells. Alternatively, select View:Go to Row to view a specific matrix row. This menu command opens the Go to Row dialog box. Enter the desired row number in the associated text box.

Customizing the Matrix

Like the worksheet, the matrix display can be modified by editing the associated matrix dialog boxes. To edit the data display and matrix column width, double-click on a matrix column heading. This action opens the Matrix Column Format dialog box.

The Matrix Column Format Dialog Box

1) The Format Drop-down List

This drop-down list option controls the display of Z values in the matrix.

· Select Decimal:1000 to display Z values using the format 1, 1000, 1E6, 1E9, etc.

· Select Scientific:1E3 to display Z values using the format 1E0, 1E3, 1E6, 1E9, etc.

· Select Engineering:1k to display Z values using the format 1.0, 1.0k, 1.0m, 1.0g, etc.

· Select Decimal:1,000 to display Z values using the format 1, 1000, 1E6, 1E9, etc.

2) The Decimal Places Text Box

The value in the Decimal places text box controls the maximum number of digits displayed after the decimal place. If the field is blank, the default value is used, which is 5 (for Double (8) internal data types). If you enter a value with more than 5 digits after the decimal place, Origin will round off the displayed value to the 5th decimal place.

3) The Internal Data Type Drop-down List

This drop-down list selection sets the maximum size for each matrix value, in bytes. The default data type is Double(8), which allocates eight bytes of storage space to each value. Double is the only data type that supports missing values. The Float(4) data type allocates four bytes of storage space per value. The Integer(2) data type allocates two bytes of storage space per value. The Long(4) data type allocates four bytes of storage space per value. However, the value is stored as an integer.

4) The Matrix Column Width Text Box

Type the desired column width in the text box.

To customize the text color, style, and heading and grid options of the matrix, double-click in the upper-left corner of the matrix window. This action opens the (Worksheet) Display Control dialog box.

Importing Data into the Matrix

To import ASCII data into a matrix, select File:Import:ASCII. This menu command opens the Import ASCII dialog box. Select the desired data file and click Open to import the file into the matrix.

The values imported into the matrix are assumed to be Z values. Set the X Y parameters in the Map Matrix XY Coordinates dialog box after reading in the Z data (

Matrix:Set Matrix XY Coordinates).

Matrix Operations

Transposing

Inverting

Shrinking

Expanding

Smoothing

Integrating

Transposing

To transpose the active matrix, select Matrix:Matrix Transpose. This menu command exchanges the matrix columns with rows, and rows with columns.

Inverting

To invert the active matrix, select Matrix:Matrix Inverse. This menu command transposes the matrix, and then divides the matrix by its determinant.

Shrinking

Matrix shrinking is a simple averaging of grid points. To shrink the active matrix, select Matrix:Matrix Shrink. This menu command opens the Shrink into 1x1 for Every dialog box. Type the column and row shrinkage factors. For example, if the original matrix is 100 columns by 20 rows, and you type 2 in the Columns and Rows text box, the matrix dimensions after shrinking will be 50 columns by 10 rows.

Expanding

Matrix expansion uses a bilinear interpolation method to add the inserted points. To expand the active matrix, select Matrix:Matrix Expand. This menu command opens the Expand for Every Cell dialog box. Type the column and row expansion factors. For example, if the original matrix is 100 columns by 20 rows, and you type 2 in the Columns and Rows text box, the matrix dimensions after expanding will be 200 columns by 40 rows.

Smoothing

To smooth the active matrix, select Matrix:Smooth Matrix Values. After clicking OK at the prompt, Origin performs the following:

· If either the number of columns or the number of rows in the matrix is less than 32, Origin expands the matrix by a factor of two, and then shrinks the matrix by a factor of two. Origin then repeats this process once more.

· If either the number of columns or the number of rows in the matrix is greater than 32, Origin shrinks the matrix by a factor of two, and then expands the matrix by a factor of two.

Integrating

To integrate the matrix starting from zero, select Matrix:Integration 3D. Origin reports the integration value in the Script window.

Converting the Matrix to a Worksheet

Direct Conversion

Creating a Worksheet with XYZ Columns

Direct Conversion

To directly convert the active matrix to a worksheet, select Edit:Convert to Worksheet:Direct. This menu command creates a new worksheet and names the window Datan, where n is the lowest number available (not currently used in a worksheet name) in the project. The worksheet is created with the same number of rows and columns as the associated matrix. The first worksheet column is a designated X column by default. Remaining columns are designated Y. Origin fills the worksheet with the matrix values, maintaining the same row and column positions in the worksheet.

Creating a Worksheet with XYZ Columns

To convert the matrix to a worksheet with XYZ values, select Edit:Convert to Worksheet:XYZ Columns. This menu command opens the Convert Worksheet to Matrix dialog box. To display worksheet values sorted by the X mapping values, select X Constant 1st from the Conversion Type drop-down list. To display worksheet values sorted by the Y mapping values, select Y Constant 1st from the Conversion Type drop-down list. After clicking OK, this menu command creates a worksheet with X, Y, and Z columns. The cell values of the matrix are converted to Z data in the worksheet. The corresponding X and Y column values in the worksheet are set by the X and Y coordinate mapping information in the matrix.

Saving a Matrix Window

Select File:Save Window As to save a matrix window with all of its data. This menu command opens the Save As dialog box. 'Matrix (*.OGM)' is selected (by default) from the List Files of Type drop-down list. Type the desired file name in the File Name text box and select the desired destination directory. You do not need to include the file extension in the File Name text box.

Saving a Matrix as a Template

To save a matrix with all formatting and relationships, but without any data, select File:Save Template As. This menu command opens the Save As dialog box. 'Matrix (*.OTM)' is selected (by default) from the Save as Type drop-down list. Type the desired file name in the File Name text box and select the desired destination directory. You do not need to include the file extension in the File Name text box.