Complete the following steps to create and run a VI that uses an Xmath script.
 |
Note You must have the Xmath software installed on your computer to use the Xmath script node because the script node invokes the Xmath script server to execute Xmath scripts. |
- Place an Xmath script node on the block diagram.
- Use the Operating or Labeling tool to enter the following script in the Xmath script node.
a = random(10, 10);
- Add an output to the Xmath script node and create an indicator for the output.
- Right-click the Xmath script node frame and select Add Output from the shortcut menu. Enter a in the output terminal to add an output for the a variable in the script. By default, the Xmath script node includes one input and one output for the error in and error out parameters.
- Verify the data type of the output terminal. In the Xmath script node, the default data type for any new input or output is Real Scalar. Right-click the a output terminal and select Choose Data Type»2-D Array of Real from the shortcut menu.
- Right-click the a output terminal and select Create»Indicator from the shortcut menu to create a 2D array of numeric indicators labeled 2-D Array of Real.
- Right-click the error out output terminal and select Create»Indicator from the shortcut menu to create an error out cluster indicator labeled error out.
- Resize the 2-D Array of Real front panel indicator so you can see all the numbers the script generates when the VI runs.
- Run the VI. LabVIEW invokes the Xmath script server, creates a 10 × 10 matrix of random values, plots that information to a graph, displays the matrix in the Xmath software, and displays the values that make up the matrix in the 2-D Array of Real front panel indicator.
- (Optional) Debug the Xmath script.
You can display a scroll bar within an Xmath script node.
 |
Note Except for the plot command, the quit command, and any graphical user interface command, a script inside an Xmath script node behaves as it does in the Xmath environment. |