Script Nodes

Use script nodes to execute text-based math scripts in LabVIEW. LabVIEW provides support for certain script nodes that invoke script servers provided by other parties to process scripts, such as the MATLAB� script server.

Note��(MathScript RT Module) The LabVIEW MathScript RT Module also provides support for MathScript Nodes, which use the MathScript RT Module engine to execute scripts.

Use input and output variables on MathScript Nodes and other script nodes to pass values between LabVIEW and a MathScript Node or other script node. The structure of an expression in a script determines whether a variable is an input or an output. For example, if the script contains the assignment statement, X = i + 3, you can create an input variable i to control how the MathScript Node or other script node calculates X, and you can create an output variable X on the MathScript Node or other script node to retrieve the final result of the script calculation.

You can use the MathScript Node to create scripts using the LabVIEW MathScriptsyntax, load scripts you wrote in the LabVIEW MathScript syntax or other text-based syntaxes, edit your scripts that you create or load, and process your MathScripts and other text-based scripts by invoking the MathScript RT Module engine. MathScript Nodes can process many of your text-based scripts created in a MATLAB or compatible environment. However, because the MathScript RT Module engine does not support all functions supported by the MATLAB software, some functions in your existing scripts might not be supported. You can implement such functions with a Formula Node or another script node.

You can use script nodes to invoke software script servers provided by other parties, such as the MATLAB script server, to execute your existing text-based scripts. A script node is similar to the Formula Node in that you can pass data to and from a script node, but such script nodes allow you to import your existing text-based script and run the imported script in LabVIEW, which invokes a script server provided by another party. You can change the script server engine with which LabVIEW communicates for a given script node by right-clicking the border of the script node, selecting Choose Script Server from the shortcut menu, and selecting the script server engine with which you want LabVIEW to communicate. The LabVIEW MathScript RT Module also installs a script server engine. You cannot change the script server engine for a MathScript Node.

Note��Because certain script nodes invoke script servers provided by other parties, you must have a licensed copy of the software from the other party installed on the computer and adequate rights to invoke the corresponding server. For example, to use a MATLAB script node, you must have a licensed copy of the MATLAB software version 6.5 or later installed on your computer. Not all script nodes are supported on all operating systems. For example, the MATLAB script node is available only on Windows. You can create script nodes only in the LabVIEW Full and Professional Development Systems. If a VI contains a script node, you can run the VI in all LabVIEW packages if you have the necessary license and access rights to the script server invoked by that script node.

MathScript Nodes can determine the data types of input and output variables. However, other script nodes, particularly MATLAB script nodes, cannot determine the data type of input and output variables you create. You must assign a LabVIEW data type to each input and output variable on these script nodes. The following table shows LabVIEW data types and the corresponding data types in the MATLAB software. This table also shows the corresponding LabVIEW MathScript data types.

LabVIEW Data Type MATLAB� Script Node Data Type MathScript Node Data Type



Double-precision, floating-point numeric
Real Scalar�DBL



Complex double-precision, floating-point numeric
Complex Scalar�CDB



1D array of double-precision, floating-point numeric
1-D Array of Real 1D-Array�DBL 1D



1D array of complex double-precision, floating-point numeric
1-D Array of Complex 1D-Array�CDB 1D



Multidimensional array of double-precision, floating-point numeric
2-D Array of Real Matrix�Real Matrix (2D only)



Multidimensional array of complex double-precision, floating-point numeric
2-D Array of Complex Matrix�Complex Matrix (2D only)



String
String Scalar�String



Path
Path N/A



1D array of string
N/A 1D-Array�String 1D
Note��(Control Design and Simulation Module) You can use additional data types with the MathScript Node, including the state-space, transfer function, and zero-pole-gain models of the LabVIEW Control Design and Simulation Module. You must have the Control Design and Simulation Module installed to use these models. Refer to the Control Design and Simulation Module documentation for more information about these models.

The MATLAB script node and the MathScript Node handle 1D array inputs only by row. To change the orientation of a 1D array from row to column or column to row, transpose the array before you perform operations on elements of the array.

Use the Conversion VIs and functions or the Path/Array/String Conversion functions to convert a LabVIEW data type to a data type that the MathScript RT Module or the MATLAB software supports.