Coerce To Type Function

Owning Palette: Conversion VIs and Functions

Requires: Base Development System

Converts the input data to a compatible data type while preserving the data value. Unlike the Type Cast function, this function does not reinterpret the input data.

Use this function in the following cases:

Details  

 Add to the block diagram  Find on the palette
type specifies the data type to which you want to convert the input data x.

To set the data type to which you want to convert the input data, wire a constant or control of the desired data type to type. LabVIEW ignores any data in the constant or control wired to type.
x specifies the data you want to convert.

This input accepts any data type.
coerced x returns the value of the input data x after the conversion.

Coerce To Type Details

The Type Cast function also converts data to a desired data type. Unlike the Type Cast function, the Coerce To Type function allows only conversion between compatible data types to preserve the value of the input data, similar to what a coercion dot does. The Type Cast function allows conversion between incompatible data types by flattening and unflattening the input data, which allows for radical reinterpretation of the data. When the desired data type requires a different memory size than the input data, the Type Cast function may reinterpret the input data. NI recommends that you use the Coerce To Type function instead of the Type Cast function to avoid reinterpreting the data.