MATLAB Function Reference    
issorted

Determine if set elements are in sorted order

Syntax

Description

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

tf = issorted(A, 'rows') returns logical true (1) if the rows of two-dimensional matrix A are in sorted order, and logical false (0) 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*


  isruntime isspace