sort
Sort an array.
Syntax
Section titled “Syntax”v = sort(arr, sort_index, sort_order, by_col)Description
Section titled “Description”Sorts the rows or columns of arr. sort_index selects which row/column to sort by (default 1). sort_order is 1 (ascending, default) or -1 (descending). by_col: false (default, sort rows) or true (sort columns).
Examples
Section titled “Examples”sort([3 1 4 1 5 9 2 6]) % [1 1 2 3 4 5 6 9]sort(T, 2, -1) % sort table T by col 2 descending