Complete the following steps to create and run a VI that uses a LabVIEW MathScript.
- Place a MathScript Node on the block diagram.
 |
Note You can create MathScript Nodes only in the LabVIEW Full and Professional Development Systems. If a VI contains a MathScript Node, you can run the VI in all LabVIEW packages. |
- Use the Operating or Labeling tool to enter the following script in the MathScript Node:
a = rand(50, 1)
plot(a)
- Add an output to the MathScript Node and create an indicator for the output.
- Right-click the MathScript 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 MathScript. By default, the MathScript Node includes one input and one output for the error in and error out parameters.
- Change the data type of the output terminal. In MathScript, the default data type for any new input or output is a Scalar»DBL. Right-click the a output and select Choose Data Type»Matrix»Real Matrix from the shortcut menu.
- Right-click the a output terminal and select Create»Indicator from the shortcut menu to create a matrix indicator labeled a.
- Right-click the error out output terminal and select Create»Indicator from the shortcut menu to create an error out cluster indicator.
- Run the VI. LabVIEW invokes the MathScript server, creates a vector of random values, plots that information to a graph, and displays the values that make up the vector in the Real Matrix front panel indicator.
- (Optional) Debug the MathScript.
You can display a scroll bar within a MathScript Node.