Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Sort array elements

sorts
the elements of `B`

= sort(`A`

)`A`

in ascending order along the
first array dimension whose size does not equal 1.

If

`A`

is a vector, then`sort(A)`

sorts the vector elements.If

`A`

is a matrix, then`sort(A)`

treats the columns of`A`

as vectors and sorts each column.If

`A`

is a multidimensional array, then`sort(A)`

operates along the first array dimension whose size does not equal 1, treating the elements as vectors.

Was this topic helpful?