sort
Sort elements of symbolic arrays
Description
Y = sort(X)X in the default ascending order.
- If - Xis a vector, then- sort(X)sorts the vector elements of- X.
- If - Xis a matrix, then- sort(X)treats the columns of- Xas vectors and sorts each column independently.
- If - Xis a multidimensional array, then- sort(X)operates along the first array dimension whose size does not equal 1, treating the elements as vectors.
[ also returns a collection of index vectors for any of
                the previous syntaxes. Y,I] =
sort(___)I is the same size as X
                and describes the arrangement of the elements of X into
                    Y along the sorted dimension. For example, if
                    X is an m-by-n matrix
                and you sort the elements of each column (dim = 1), then each
                column of I is an index vector of the sorted column of
                    X, such that
for j = 1:n Y(:,j) = X(I(:,j),j); end
Examples
Input Arguments
Output Arguments
Tips
- Calling - sorton arrays of numbers that are not symbolic objects invokes the MATLAB®- sortfunction.

