Coerce To Type Function

LabVIEW 2018 Help


Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)


LabVIEW 2015 Help
LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help

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:

  • To eliminate a coercion dot
  • To convert data without a type definition to a compatible type definition or vice versa
  • To rename data on the wire, such as a user event refnum

Details  

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.

WAS THIS ARTICLE HELPFUL?

Not Helpful