Programming |
Shifting and Sorting Matrices
You can sort matrices, multidimensional arrays, and cell arrays of strings along any dimension and in ascending or descending order of the elements. The sort functions also return an optional array of indices showing the order in which elements were rearranged during the sorting operation.
Shift and Sort Functions
Use these functions to shift or sort the elements of a matrix.
Function |
Description |
circshift |
Circularly shift matrix contents. |
sort |
Sort array elements in ascending or descending order. |
sortrows |
Sort rows in ascending order. |
issorted |
Determine if matrix elements are in sorted order. |
Preallocating Memory | Shifting the Location of Matrix Elements |
© 1994-2005 The MathWorks, Inc.