LabVIEW 2015 Help | |

LabVIEW 2016 Help | |

LabVIEW 2017 Help | |

LabVIEW 2018 Help | |

LabVIEW 2019 Help |

**Owning Palette:** Comparison Functions

**Requires:** Base Development System

Determines whether **x** falls within a range specified by the **upper limit** and **lower limit** inputs and optionally coerces the value to fall within the range. The function performs the coercion only in Compare Elements mode. This function accepts time stamp values if all inputs are time stamp values. You can change the comparison mode of this function.

The connector pane displays the default data types for this polymorphic function.

This function compares the input data values according to the Boolean comparison rules. If the function is in Compare Aggregates mode, it returns the unchanged value of **x** in **coerced(x)** rather than a coerced value. The function considers each input array as a single aggregate object, similar to a cluster, where the first element is primary in the comparison. If **x** is greater than **upper limit** and the function is in Compare Elements mode (default), the function coerces **x** to the **upper limit** value. If **x** is less than **lower limit** and the function is in Compare Elements mode, the function coerces **x** to the lower limit value.

If you wire a combination of signed and unsigned integers to the **upper limit**, **x**, and **lower limit** inputs of the In Range and Coerce function, all of the inputs will be coerced to the same unsigned integer type. This can lead to unexpected results for negative input values. For example, wiring an unsigned integer to **upper limit** and a negative signed integer to **lower limit** may cause LabVIEW to interpret the **lower limit** input as larger than the **upper limit** input. To avoid this issue, convert integer inputs to the same type before you wire them to the In Range and Coerce function.

If the **lower limit** value is greater than the **upper limit** value, **In Range?** is always FALSE and LabVIEW switches the **lower limit** value and the **upper limit** value internally before computing **coerced(x)**.

Refer to the In Range and Coerce VI in the labview\examples\Comparison directory for an example of using the In Range and Coerce function.

Helpful

Not Helpful