Programming Previous page   Next Page

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.

This section covers

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.


Previous page  Preallocating Memory Shifting the Location of Matrix Elements Next page

© 1994-2005 The MathWorks, Inc.