Sorting Arrays
sort(v)—Returns a vector with the values from v sorted in ascending order.
reverse(A)—Reverses the order of elements in a vector, or the order of rows in a matrix A.
csort(A, n)—Returns an array formed by rearranging rows of A until column n is in ascending order.
rsort(A, n)—Returns an array formed by rearranging columns of A until row n is in ascending order.
Arguments
v is a vector.
A is a vector or a matrix.
n is an integer.
If v or A contains complex elements, the imaginary part is ignored. Their row and column indices are numbered starting with zero unless you change the ORIGIN.
Additional Information
The sort functions use a heapsort algorithm (Press, et. al, Numerical Recipes). The heapsort procedure is not a stable sort, meaning that if you sort values with repeated elements, they appear in an arbitrary order.
Was this helpful?