FiltHigh

(Engine-Level Function)

Description: Sets the values in an array sub-range that fall above a specified upper limit to a new value.
Returns: Nothing
Usage: Script only.
Function Groups: Array
Related to: ArrayOp1 | ArrayOp2 | Filter | FiltLow
Format: FiltHigh(ArrayElem, N, Limit, Value)
Parameters:  
ArrayElem
Required. Any array element giving the starting point in the array for the search. The subscript for the array may be any numeric expression. If processing a multidimensional, the usual rules apply to decide which dimension should be used.
N
Required. Any numeric expression giving the number of array elements to use, starting at the element given by the first parameter. If N extends past the upper bound of the lowest array dimension, this computation will "wrap-around" and resume at element 0, until N elements have been processed.
Limit
Required. Any numeric expression giving the upper cutoff value for the array elements. Any array elements in the range that are strictly greater than this value are set to the Value parameter.
Value
Required. Any numeric expression giving the new value to set the array elements that fall above the Limit parameter. The function still continues if this parameter is invalid, in which case the new values become invalid.
Comments: The statement is useful for setting array elements above a limit to a maximum value or to invalid.

Example:

Assume that there exists an array whose subscripts start at 0, such that x = { 2, 1, invalid, 10 }

  If ChangeArray;
  [
    FiltHigh(X[0] { Start of array }, 
             4 { Number of elements to process }, 
             2 { Max value in the array }, 
             Invalid { Default value if over the limit }); 
    ChangeArray = 0; 
  ]

If the variable ChangeArray is set to true, x will be changed to x = {2, 1, Invalid, Invalid }