colnames (DataMatrix) - Retrieve or set column names of DataMatrix object

Syntax

ReturnColNames = colnames(DMObj)
ReturnColNames = colnames(DMObj, ColIndices)
DMObjNew = colnames(DMObj, ColIndices, ColNames)

Arguments

DMObj

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

ColIndices

One or more columns in DMObj, specified by any of the following:

  • Positive integer

  • Vector of positive integers

  • String specifying a column name

  • Cell array of strings

  • Logical vector

ColNames

Column names specified by any of the following:

  • Numeric vector

  • Cell array of strings

  • Character array

  • Single string, which is used as a prefix for column names, with column numbers appended to the prefix

  • Logical true or false (default). If true, unique column names are assigned using the format col1, col2, col3, etc. If false, no column names are assigned.

    Note   The number of elements in ColNames must equal the number of elements in ColIndices.

Return Values

ReturnColNamesString or cell array of strings containing column names in DMObj.
DMObjNew

DataMatrix object created with names specified by ColIndices and ColNames.

Description

ReturnColNames = colnames(DMObj) returns ReturnColNames, a cell array of strings specifying the column names in DMObj, a DataMatrix object.

ReturnColNames = colnames(DMObj, ColIndices) returns the column names specified by ColIndices. ColIndices can be a positive integer, vector of positive integers, string specifying a column name, cell array of strings, or a logical vector.

DMObjNew = colnames(DMObj, ColIndices, ColNames) returns DMObjNew, a DataMatrix object with columns specified by ColIndices set to the names specified by ColNames. The number of elements in ColIndices must equal the number of elements in ColNames.

See Also

Bioinformatics Toolbox function: DataMatrix (object constructor)

Bioinformatics Toolbox object: DataMatrix object

Bioinformatics Toolbox method of a DataMatrix object: rownames

  


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