Configuring the Data Type of MathScript Node Output Terminals (MathScript RT Module)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

LabVIEW determines the data types of variables in MathScript Nodes at edit time. The data type is the smallest data type that encompasses all possible values of the variable. For example, if the value of a variable is the square root of a number, LabVIEW determines the data type to be complex double-precision, floating-point numeric even though the value might be an integer.

By default, LabVIEW automatically selects the data type for output terminals that have variables assigned when you click outside a MathScript Node. If a variable assigned to an output terminal is not defined in the script, or if LabVIEW cannot detect variables in the script, for example, because the script contains an error, you must resolve the condition before LabVIEW can select the data type of the terminal.

Right-click an output terminal and move the cursor over the Choose Data Type shortcut menu item to view the data type or data types LabVIEW determines in the shortcut menu. LabVIEW marks the data types it determines with an asterisk (*), shown as follows.

If LabVIEW can determine the data type of a variable only at run time, you must configure the data type of the terminal manually. Complete the following steps to change the data type of an output terminal on a MathScript Node manually.

  1. Right-click the terminal of the output and select Choose Data Type»All Types from the shortcut menu. A list of the available data types appears.
  2. Select the data type you want to use.

If you configure a terminal manually using a different data type than the data type LabVIEW determines, LabVIEW coerces the value to the data type you select when possible and places a coercion dot on the output terminal. LabVIEW returns an error when the coercion is not possible.

Note  If LabVIEW coerces a value to a smaller data type than the data type LabVIEW determines, data loss might occur. For example, if LabVIEW coerces a complex number to a non-complex number, you might lose the imaginary part of the data. If LabVIEW coerces a floating-point number to an integer, you might lose the fractional part of the data.

After you configure the data type of an output terminal manually, LabVIEW no longer selects the data type of the terminal. To re-enable the automatic selection of data types for the terminal, right-click the output terminal and select Choose Data Type»Auto Select Type from the shortcut menu.

MathScript Node Input Terminals

Because the MathScript Node behaves differently than the MATLAB script node, you cannot change the data type of input terminals. Instead, if you wire an unsupported data type to an input terminal on a MathScript Node, LabVIEW displays a broken wire.


Not Helpful