Products & Services Solutions Academia Support User Community Company

Learn more about Bioinformatics Toolbox   

sortrows (DataMatrix) - 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, ...)

Arguments

DMObj1

DataMatrix object, such as created by DataMatrix (object constructor).

Column

One or more columns in DMObj1 by which to sort the rows. Choices are:

  • Positive integer

  • Vector of positive integers

  • String specifying a column name

  • Cell array of strings specifying multiple column names

  • Logical vector

'RowName'

String that specifies to sort the rows by the row names.

Mode

String specifying the order by which to sort the rows. Choices are 'ascend' (default) or 'descend'.

Return Values

DMObjNew

DataMatrix object created from sorting the rows of another DataMatrix object.

Indices

Index vector that links DMObj1 to DMObjNew. In other words, DMObjNew = DMObj1(idx,:).

Description

DMObjNew = sortrows(DMObj1) sorts the rows in 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.

DMObjNew = sortrows(DMObj1, Column) sorts the rows in 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.

DMObjNew = sortrows(DMObj1, 'RowName') sorts the rows in DMObj1 in ascending order according to the row names.

DMObjNew = sortrows(DMObj1, ..., Mode) specifies the order of the sort. Mode can be 'ascend' (default) or 'descend'.

[DMObjNew, Indices] = sortrows(DMObj1, ...) returns Indices, an index vector that links DMObj1 to DMObjNew. In other words, DMObjNew = DMObj1(idx,:).

See Also

Bioinformatics Toolbox function: DataMatrix (object constructor)

Bioinformatics Toolbox object: DataMatrix object

Bioinformatics Toolbox method of a DataMatrix object: sortcols

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS