Products & Services Solutions Academia Support User Community Company

Learn more about Bioinformatics Toolbox   

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

Arguments

DMObj1

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

Row

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

  • Positive integer

  • Vector of positive integers

  • String specifying a row name

  • Cell array of strings specifying multiple row names

  • Logical vector

'ColName'

String that specifies to sort the columns by the column names.

Mode

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

Return Values

DMObjNew

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

Indices

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

Description

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

DMObjNew = sortcols(DMObj1, Row) sorts the columns in 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.

DMObjNew = sortcols(DMObj1, 'ColName') sorts the columns in DMObj1 in ascending order according to the column names.

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

[DMObjNew, Indices] = sortcols(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: sortrows

  


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