MATLAB Function Reference Previous page   Next Page
issorted

Determine if set elements are in sorted order

Syntax

Description

tf = issorted(A) returns logical 1 (true) if the elements of vector A are in sorted order, and logical 0 (false) otherwise. Vector A is considered to be sorted if A and the output of sort(A) are equal.

tf = issorted(A, 'rows') returns logical 1 (true) if the rows of two-dimensional matrix A are in sorted order, and logical 0 (false) otherwise. Matrix A is considered to be sorted if A and the output of sortrows(A) are equal.

Remarks

For character arrays, issorted uses ASCII, rather than alphabetical, order.

You cannot use issorted on arrays of greater than two dimensions.

Examples

Using issorted on a vector,

Using issorted on a matrix,

See Also

sort, sortrows, ismember, unique, intersect, union, setdiff, setxor, is*


Previous page  isscalar isspace Next page

© 1994-2005 The MathWorks, Inc.