sortrows

  • B = sortrows(A,<col>) sorts the rows of a matrix A by the column(s) specified by the vector col
    • When col is omitted, sortrows compares the first column first; rows tied on the first column are then compared by the second column, and so on
    • When col is given, rows are compared by the col(1)-th column, then the col(2)-th, and so on; rows that match in every listed column keep their original order

The following syntaxes behave as in Matlab Functions - sort:

  • B = sortrows(___,direction)
  • B = sortrows(___,Name,Value)
  • [B,index] = sortrows(___)