sortrows
Sort rows of DataMatrix object in ascending or descending order
Syntax
DMObjNew
=
sortrows(DMObj1
)
DMObjNew
=
sortrows(DMObj1
, Column
)
DMObjNew
=
sortrows(DMObj1
, 'RowName')
DMObjNew
=
sortrows(DMObj1
, ..., Mode
)
[DMObjNew
, Indices
]
= sortrows(DMObj1
, ...)
Input Arguments
DMObj1 | DataMatrix object, such as created by |
Column | One or more columns in
|
'RowName' | Character vector or string that specifies to sort the rows by the row names. |
Mode | Character vector or string specifying the order by which to sort the rows. Choices are
|
Output Arguments
DMObjNew | DataMatrix object created from sorting the rows of another DataMatrix object. |
Indices | Index vector that links |
Description
sorts the rows
in DMObjNew
=
sortrows(DMObj1
)DMObj1
in ascending order based on the
elements in the first column. For any rows that have equal elements
in a column, sorting is based on the column immediately to the right.
sorts
the rows in DMObjNew
=
sortrows(DMObj1
, Column
)DMObj1
in ascending order based
on the elements in the specified column. Any rows that have equal
elements in the specified column are sorted based on the elements
in the next specified column.
sorts
the rows in DMObjNew
=
sortrows(DMObj1
, 'RowName')DMObj1
in ascending order according
to the row names.
specifies
the order of the sort. DMObjNew
=
sortrows(DMObj1
, ..., Mode
)Mode
can be 'ascend'
(default)
or 'descend'
.
[
returns DMObjNew
, Indices
]
= sortrows(DMObj1
, ...)Indices
,
an index vector that links DMObj1
to DMObjNew
.
In other words,
.DMObjNew
= DMObj1
(idx,:)
Version History
Introduced in R2008b