Compress
| Description: | Eliminate invalid array entries. |
| Returns: | Nothing |
Usage: ![]() |
Script Only. |
| Function Groups: | Array |
| Related to: | ArrayOp1 | ArrayOp2 | AValid | Filter |
| Purpose: | This statement moves all of the valid array entries to the first part of the array, maintaining the order of the valid elements. |
Format: ![]() |
Compress(ArrayElem, N) |
| Parameters: |
| ArrayElem |
| Required. Any array element giving the starting point for the array search. The subscript for the array may be any numeric expression.If processing a multidimensional array, the usual rules apply to decide which dimension should be examined. |
| 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 array dimension, this computation will "wrap-around" and resume at element 0, until N elements have been processed. |
| Comments: | None |
Example:
Init [
If 1 Main;
[
x[0] = 4;
x[1] = Invalid;
x[2] = 5;
x[3] = 6;
x[4] = Invalid;
x[5] = 3;
Compress(x[0], 6);
]
]
This will result in the first 4 elements of array x being set to 4, 5, 6 and 3 respectively, with the last 2 elements being set invalid.
