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