Determining Range Values and Coercing Data in Arrays

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

Note The following steps use numeric values as an example. You can determine if a value in an array of strings or an array of Boolean values 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 an array to the x input of the function.
  3. Wire the maximum value for the range to the upper limit input of the function. If a value in 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 a value in x is less than this value, the function coerces the number to the lower limit. The default value is negative infinity.
Note You can wire a scalar value or an array of numbers to upper limit or lower limit. If you wire a scalar value to upper limit or lower limit, LabVIEW checks each element in the array you wire to x against the scalar value limit. If you wire an array to upper limit or lower limit, LabVIEW checks each element in the array you wire to x against the corresponding element in the array you wired as a limit.
  1. Wire the coerced(x) output of the function to a subVI, function, or indicator that accepts an array of numbers. If each element of the array you wired to x is within the range set by the upper limit and lower limit inputs, the value in x remains unchanged. If the element of the array you wired to x is not in range, the function coerces the element to the upper limit or lower limit.
  2. Wire the In Range? output of the In Range and Coerce function to an array of Boolean values. Each Boolean value in the array corresponds to an element in the array you wired to x and indicates if the element is within the range you specify.
  3. Run the VI.