The
SORT
function returns a vector of subscripts that allow access to the elements of
Array
in ascending order. The result is always a vector of longword type with the same number of elements as
Array
.
Calling Sequence
Result = SORT(
Array
)
Arguments
Array
The array to be sorted.
Array
can be any basic type of vector or array. String arrays are sorted using the ASCII collating sequence. Complex arrays are sorted by their magnitude.
Example
To illustrate, assume the vector A contains the elements [4, 3, 7, 1, 2]. Then:
SORT(A) = [3, 4, 1, 0, 2]
because:
A[3] < A[4] < A[1] < A[0] < A[2]
To see the elements of A in sorted order use the expression enter: