Command Reference : Matrix Language Reference
  
 
@sort
Sort elements of matrix or vector.
Syntax: @sort(m[, o, t])
m: matrix or vector
o: (optional) string
t: (optional) string
Return: matrix, vector
Returns a matrix or vector containing the sorted elements of the matrix or vector object m.
Note that sorting a matrix ranks every element of the matrix and arranges the results to match the elements of the original matrix, from upper left to lower right.
The o option controls the direction of the ranking:
“a” (ascending - default) or “d” (descending)
The t option controls tie-handling:
Ties are broken according to the setting of t: “i” (ignore), “f” (first), “l” (last), “a” (average - default), “r” randomize.
If you wish to specify tie-handling options, you must also specify the order option (e.g. ‘@sort(x, “a”, “i”)’).
Examples
vector sorted = @sort(v1,"a","f")
Cross-references
See also @ranks, @capplyranks, @rapplyranks, @colsort, and @rowsort.