5.6.1.1 Menu Options and Dialog Controls for Setting Matrix Values

To use the Set Values dialog to generate data for a matrix, simply input expressions in the Formula and/or Before Formula Scripts and then click the Apply button (or the OK button) to set the matrix values.

SetMatrixValuesPanel.png

Formula Menu

The menu options under Formula are used to save and load expressions.

Load Sample

Load a sample expression.

Load

Load a saved expression.

Save

Save the current expression.

Save As

Save the expression using another name.

Loaded scripts will subsequently appear at the bottom of the menu as Most Recently Used entries.

Mat(1) Menu

Origin lists all the matrixobject of the current matrix in the form of Mat(N), where N is the index of a matrixobject. You can select one to add to Formula or Before Formula Scripts depending on where the cursor is.

Mat(N)

You can select this menu option to add Mat(N) to Formula or Before Formula Scripts. N is the index of a matrixobject.

Matrix Browser

Select this to open the Matrix Object Browser dialog which helps you to choose the matrixobject to add.

Mat(A) Menu

Origin lists all the matrixobjects of the current matrix in the form of Mat(Short Name): Long Name or Mat(Long Name):Short Name, such as Mat(1): Time or Mat("Time"):1. You can select one to add to Formula edit box or Before Formula Scripts depending on where the cursor is.

Prefer Long Name

Check this to use the long name to specify the matrix. When this item is not selected, Origin will use the matrixobject short name instead.

Mat(Long Name)

You can select this menu option to add Mat(Long Name) to Formula or Before Formula Scripts.

Matrix Browser

Select this to open the Matrix Object Browser dialog which helps you to choose the matrixobject to add.

Function Menu

This menu can be used to add functions or variables for building the expression. You can select a function or a variable to add it to either the Formula edit box or the Before Formula Scripts edit box. The code is added to Formula edit box or Before Formula depending on the current cursor location.

Recent Used

Lists the 10 most recently used functions.

Search and Insert...

Open the Search and Insert Functions dialog to search for built-in functions.

Functions in different categories

Select a function to add to Formula edit box or Before Formula Scripts. For more details about these functions, please read built-in LabTalk functions.

Variables Menu

This menu can be used to add Range or Info variables.

Predefined Variables

Add a variable or a constant to Formula edit box or Before Formula Scripts. Available variables and constants include:

  • _ThisMatNum
    This is a system variable referring to the current matrixobject.
  • [i,j]
    This stands for the row index and column index of the current matrixobject. These values are iterated over the range specified in Row/Column From/To.
  • cell(i,j)
    This is the cell of the current matrixobject.
  • pi
    This is the PI constant.
  • x
    This is the x values of the current matrixobject.
  • y
    This is the y values of the current matrixobject.
Project Variables

Add project variables to Column Formula or Before Formula Scripts. Up to 10 project variables (and their values) are listed in the sub-menu. View and select all project variables from the Project Variables dialog opened by clicking More... sub-item.

Add Range Variable...

Select one or more Range Variables to insert into Set Values.

Add Info Variable...

Select one or more Info variables to insert into Set Values as either links or static values.

Add Range Variable by Selection...

It minimums the Set Column Values dialog to select Range Variables from Matrix window to insert into Set Values.

Formula

You can add a single line expression in this edit box for generating data. Functions, operators and variables can be used here. Note that the expression is half of an equation Cell(i,j) =, and if i and j are used, the expression is evaluated over the selected From/To in Row(i) & Column(j).

Before Formula Scripts

You can enter multi-line LabTalk scripts in this edit box and the scripts will be executed before the expression in Formula edit box is executed. You can click the Show/Hide Scripts button ShowOrHideButton.png to show/hide this edit box.

Range controls

SetMatrixRange.png

Define the range whose values will be set with the expression.

To change the range, you can select None for Recalculate drop-down list and then overwrite the values in the From and To boxes.

Matrixobject First/Next/Prev/Last

NavagationButtons.png

You can use this group of buttons to switch from one matrixobject to another. This allows you to use the Set Values dialog on multiple matrixobjects without closing the dialog. Multiple Matrixobjects can exist in a single Matrix Layer (the MatrixSheet) and these buttons are restricted to the current sheet.

Buttons

Search and Insert Functions

Open the Search and Insert Functions dialog to search functions by clicking Search Insert Functions.png button.

Open Properties dialog

Open the Matrix Properties dialog.

Apply

Set values with the expression without closing the dialog box.

Cancel

Close the dialog box and do nothing.

OK

Set values with the expression and then close the dialog box.

Show/Hide Scripts
(Down/Up Arrow button)

Show or hide the Before Formula Scripts panel.

Example

The following short tutorial will show you how to use this dialog to generate data for a matrix.

  1. Create a new matrix by clicking the New Matrix button Create a new Matrix.png on the Standard toolbar.
  2. Select Matrix: Set Values from the Origin menu to open the Set Values dialog.
  3. Enter c1*sin(i) + c2*cos(j) in the Formula panel and input c1=3;c2=4 into Before Formula Scripts. Then click the OK button. The Set values dialog will be closed and the matrix should be filled with numbers. You will see the results in the following matrix. (You can highlight the entire matrix and select Plot: Contour: Contour-Color Fill to create a graph. And the graph should be similar to the one next to the matrix.)
Quick Start SetMatrixValues.png