issortedrows
Determine if matrix or table rows are sorted
Syntax
Description
TF = issortedrows( returns logical
A)1 (true) when the elements of the
first column of A are in sorted order and logical
0 (false) otherwise. By default,
issortedrows looks for ascending sorted order. When the
first column has consecutive repeated elements,
issortedrows determines whether the next column is in
ascending order, and repeats this behavior for succeeding equal values.
TF = issortedrows(___, returns
1 when the first column of direction)A is in the order specified
by direction for any of the previous syntaxes.
For example, issortedrows(A,'monotonic') checks
if the first column of A is in ascending or descending
order. direction can also be a cell array of character
vectors representing multiple directions for each column being checked.
For example, issortedrows(A,[2 3],{'ascend' 'descend'}) checks
if the second column of A is in ascending order,
then checks if the third column is in descending order to break ties.
TF = issortedrows(___, specifies
additional parameters for checking sort order. For example, Name,Value)issortedrows(A,'ComparisonMethod','abs') checks
if the elements in the first column of A are sorted
by magnitude.
TF = issortedrows( checks
if the rows of a table are in ascending order based on the elements
in the first variable. If elements in the first variable are repeated,
then tblA)issortedrows checks the elements in the second
variable, and so on.
If tblA is a timetable, then issortedrows checks
if the rows of tblA are in ascending order based
on its row times. Row times of a timetable label the rows along the
first dimension of the timetable.
TF = issortedrows( checks
if the rows of a table are in ascending order based on its row names.
Row names of a table label the rows along the first dimension of the
table.tblA,'RowNames')
This syntax is not supported when tblA is
a timetable.
TF = issortedrows( checks
if the rows of a table are sorted by row labels tblA,rowDimName)rowDimName along
the first dimension.
If
tblAis a table, then the labels are row names.If
tblAis a timetable, then the labels are row times.
TF = issortedrows( checks
if the rows of a table are in ascending order based on the elements
in variables tblA,vars)vars. For example, if Age and Weight are
variables of tblA, then issortedrows(tblA,{'Age','Weight'}) checks
if the rows are in ascending order by age, then by weight to break
ties.
If
tblAis a table with row names, thenvarscan include the row names.If
tblAis a timetable, thenvarscan include the row times.
TF = issortedrows(___, checks
if a table is sorted in the order specified by direction)direction for
any of the previous table syntaxes. direction can
be a single sort order such as 'descend' or 'monotonic',
which is applied to each specified variable, row name, or row time. direction can
also be a cell array whose elements contain different sort orders
for each specified variable, row name, or row time that issortedrows operates
on.
TF = issortedrows(___, specifies
additional parameters for sorting tables. For example, Name,Value)issortedrows(tblA,'Var1','MissingPlacement','first') checks
that missing elements in Var1, such as NaN or NaT,
are placed at the beginning of the table.
Examples
Input Arguments
Name-Value Arguments
Extended Capabilities
Version History
Introduced in R2017a