issorted
Determine if array is sorted
Syntax
Description
TF = issorted( returns logical
A)1 (true) when the elements of
A are in sorted order and logical 0
(false) otherwise.
If
Ais a vector, thenissortedreturns 1 when the vector elements are in ascending order.If
Ais a matrix, thenissortedreturns 1 when each column ofAis in ascending order.If
Ais a multidimensional array, thenissortedreturns 1 whenAis in ascending order along the first dimension whose size does not equal 1.If
Ais a timetable, thenissortedreturns 1 when its row time vector is in ascending order. To check the ordering of row times or variables of a timetable with additional options, use theissortedrowsfunction.
TF = issorted(___, returns
1 when direction)A is sorted in the order specified by direction for
any of the previous syntaxes. For example, issorted(A,'monotonic') returns
1 if the elements of A are ascending or descending.
TF = issorted(___, specifies
additional parameters for checking sort order. For example, Name,Value)issorted(A,'ComparisonMethod','abs') checks
if A is sorted by magnitude.
TF = issorted( returns
1 when the elements of the first column of a matrix are sorted. If
the first column contains repeated elements, then A,'rows')issorted looks
at the ordering of the second column to determine TF.
In general, issorted looks to the column immediately
to the right to determine TF when the current and
previous columns have repeated elements.
If
Ais a timetable, thenissortedchecks if the row time vector is in ascending order.This syntax is not supported for a matrix of character vectors.
Note
This syntax is not recommended. Use issortedrows instead.
Examples
Input Arguments
Name-Value Arguments
More About
Extended Capabilities
Version History
Introduced before R2006a
See Also
sort | sortrows | issortedrows

