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.
| . 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. |
- Place the In Range and Coerce function on the block diagram.
- Wire a numeric value to the x input of the function.
- 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.
- 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.
- (Optional) Wire the coerced 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.
- 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.
- Run the VI.