The following example will get the same results as Example 1. So you can use range variables, string variables, loops and LabTalk accessible X-Functions. In addition to built-in functions or user-defined functions, any LabTalk scripts are supported here. You can input multi-line LabTalk scripts in the Before Formula Scripts edit box and leave the Formula edit box empty. Click the OK button to execute the formula.Īdd Expressions only in Before Formula Scripts
The cursor is positioned within the parentheses. Select Function: Math: Cos(x) from the menu of the dialog to add cos() to the Formula edit box. Click the next button to set values for the second matrix object.Then input i in the Formula edit box and click the Apply button to generate data for it. Select Matrix: Set Values to open the Set Values dialog.Then click the icon on the upper-right corner of the matrix and select Add to add a new matrix object. The following is an example that shows how functions can be used. The expression in the Formula edit box can include built-in functions and user-defined functions. You can add a single-line expression in the Formula edit box and leave the Before Formula Scripts panel empty. You can use them in the Formula edit box. The letter i and j are system variables that store the current row index and column index while the letter x and y represent the current X and Y values.You can also create a User-Defined Function yourself. Origin offers lots of built-in functions under the Function menu, which can be directly used in the expression.Multi-line LabTalk scripts can be input here, which will be executed before matrix values are set with the formula in the Formula edit box.
Note how this expression is the right-hand part of a complete statement: Only a single-line expression can be input here. There are two places to define expressions: The expression can contain arithmetic operators, range variables, built-in LabTalk functions and user-defined functions etc. The expression used in the Set Values dialog should follow LabTalk syntax.