Command Reference : Matrix Language Reference
  
 
@rapplyranks
Syntax: @rapplyranks(m, v[, n])
Argument 1: vector, matrix, or sym, m
Argument 2: vector, v
Argument 3: (optional) integer, n
Return: vector, matrix, or sym
Reorder the columns of a matrix m using the ranks in the vector v. If the optional argument n is specified, only the columns in row n will be reordered. v should contain unique integers from 1 to the number of rows of m.
matrix m2 = @rapplyranks(m1, v1)
reorders the columns of the matrix M1 using the ranks in V1, while
matrix m3 = @rappyranks(m1, v1, 3)
reorders only the columns in row 3 of M1.
Note that you may use the @ranks function to obtain the ranks of a vector. Obtaining unique integer ranking for data with ties requires use of the “i” or “r” option in @ranks, as in
vector y = @ranks(x, "a", "i")
See also @ranks, @capplyranks, @sort, @permute.