﻿

# Determining Range Values and Coercing Data

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Complete the following steps to determine if a value falls within a range specified by the upper limit and lower limit inputs of the In Range and Coerce function and optionally to coerce the value to fall within the range.

 Note  The following steps use numeric values as an example. You can determine if a value in a string or Boolean object falls within a range and optionally coerce the value to fall within the range.
1. Add the In Range and Coerce function to the block diagram.

2. Wire a numeric value to the x input of the function.
3. Wire the maximum value for the range to the upper limit input of the function. If x is greater than this value, the function coerces the number to the upper limit. The default value is positive infinity.
4. Wire the minimum value for the range to the lower limit input of the function. If x is less than this value, the function coerces the number to the lower limit. The default value is negative infinity.
5. (Optional) Wire the coerced(x) output of the function to a subVI, function, or indicator that accepts a number. If the number in x is within the range set by the upper limit and lower limit inputs, the value in x remains unchanged. If the number in x is not in range, the function coerces the number to the upper limit or lower limit.
6. Wire the In Range? output of the In Range and Coerce function to a Boolean indicator to determine if the number in x is within the range set by the upper limit and lower limit inputs, or wire the In Range? output to a subVI or function that accepts a Boolean value as an input. If the number in x is within the range, In Range? returns a TRUE value. If the number is not within the range, In Range? returns a FALSE value.
7. Run the VI.