Main Content

DataMatrix

Create DataMatrix object

Syntax

DMobj = DataMatrix(Matrix)
DMobj = DataMatrix(Matrix, RowNames, ColumnNames)
DMobj = DataMatrix('File', FileName)
DMobj = DataMatrix(..., 'RowNames', RowNamesValue, ...)
DMobj = DataMatrix(..., 'ColNames', ColNamesValue, ...)
DMobj = DataMatrix(..., 'Name', NameValue, ...)
DMobj = DataMatrix('File', FileName, ...'Delimiter', DelimiterValue, ...)
DMobj = DataMatrix('File', FileName, ...'HLine', HLineValue, ...)
DMobj = DataMatrix('File', FileName, ...'Rows', RowsValue, ...)
DMobj = DataMatrix('File', FileName, ...'Columns', ColumnsValue, ...)

Arguments

Matrix

Two-dimensional numeric or logical array.

RowNames

Row names for the DataMatrix object, specified by a numeric vector, character array, string vector, or cell array of character vectors, whose elements are equal in number to the number of rows in Matrix. RowNames are typically gene names or probe identifiers from a microarray experiment.

Note

The row names do not need to be unique.

ColumnNames

Column names for the DataMatrix object, specified by a numeric vector, character array, string vector, or cell array of character vectors, whose elements are equal in number to the number of columns in Matrix. ColumnNames are typically sample identifiers from a microarray experiment.

Note

The column names do not need to be unique.

FileName

Character vector or string specifying a file name or a path and file name of a tab-delimited TXT or XLS file that contains table-oriented data and metadata.

Note

Typically, the first row of the table contains column names, the first column contains row names, and the numeric data starts at the 2,2 position. The DataMatrix function will detect if the first column does not contain row names, and read data from the first column. However, if the first row does not contain header text (column names), set the HLine property to 0.

RowNamesValue, ColNamesValue

Row names or column names for the DataMatrix object. Choices are:

  • Numeric vector, character array, string vector, or a cell array of character vectors, whose elements are equal in number to the number of rows or number of columns of numeric data in the input matrix.

  • A character vector or string, which is used as a prefix for row or column names. Numbers will be appended to the prefix.

  • true — Unique row or column names will be assigned using the formats row1, row2, row3, etc., or col1, col2, col3, etc.

  • false — Default. No row or column names are assigned.

Note

The row or column names do not need to be unique.

NameValue

Character vector or string specifying a name for the DataMatrix object. Default is ''.

DelimiterValue

Character vector or string specifying a delimiter symbol to use for the input file. Typical choices are:

  • ' '

  • '\t' (default)

  • ','

  • ';'

  • '|'

HLineValue

Positive integer that specifies which row of the input file contains the column header text (column names). Default is 1.

When creating the DataMatrix object DMobj, the DataMatrix function loads data from (HLineValue + 1) to the end of the file.

Tip

If the input file does not contain column header text (column names), set HLineValue to 0.

RowsValue, ColumnsValue

A subset of rows or columns in File, for the DataMatrix function to use to create the DataMatrix object. Choices are:

  • Cell array of character vectors

  • Character array

  • String vector

  • Numeric or logical vector

Description

A DataMatrix object encapsulates measurement data and feature metadata from a microarray experiment so that it can be indexed by gene names or probe identifiers and by sample identifiers. For examples of creating and using DataMatrix objects, see Representing Expression Data Values in DataMatrix Objects.

Note

The DataMatrix constructor function is part of the microarray object package. To make it available, type the following in the MATLAB® command line:

import bioma.data.*

Otherwise, use bioma.data.DataMatrix instead of DataMatrix, in the following syntaxes.

DMobj = DataMatrix(Matrix) creates a DataMatrix object, DMobj, from Matrix, a two-dimensional numeric or logical array. Matrix can also be a DataMatrix object.

DMobj = DataMatrix(Matrix, RowNames, ColumnNames) creates a DataMatrix object, DMobj, from Matrix, a two-dimensional numeric or logical array, with row names and column names specified by RowNames and ColumnNames. RowNames and ColumnNames can be a numeric vector, character array, string vector, or cell array of character vectors, whose elements are equal in number to the number of rows and number of columns, respectively, in Matrix. RowNames are typically gene names or probe identifiers, while ColumnNames are typically sample identifiers.

Note

The row or column names do not need to be unique.

DMobj = DataMatrix('File', FileName) creates a DataMatrix object, DMobj, from FileName, a character vector or string specifying a file name or a path and file name of a tab-delimited TXT or XLS file that contains table-oriented data and metadata.

Note

Typically, the first row of the table contains column names, the first column contains row names, and the numeric data starts at the 2,2 position. The DataMatrix function will detect if the first column does not contain row names, and read data from the first column. However, if the first row does not contain header text (column names), set the HLine property to 0.

DMobj = DataMatrix(..., 'PropertyName', PropertyValue, ...) calls DataMatrix with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Each PropertyName must be enclosed in single quotation marks and is case insensitive. These property name/property value pairs are as follows:

DMobj = DataMatrix(..., 'RowNames', RowNamesValue, ...) specifies row names for DMobj. RowNamesValue can be any of the following:

  • Numeric vector, character array, string vector, or a cell array of character vectors, whose elements are equal in number to the number of rows of numeric data in the input matrix.

  • A character vector or string, which is used as a prefix for row names. Row numbers will be appended to the prefix.

  • true — Unique row names will be assigned using the format row1, row2, row3, etc.

  • false — Default. No row names are assigned.

Note

The row names do not need to be unique.

DMobj = DataMatrix(..., 'ColNames', ColNamesValue, ...) specifies column names for DMobj. ColNamesValue can be any of the following:

  • Numeric vector, character array, string vector, or a cell array of character vectors, whose elements are equal in number to the number of columns of numeric data in the input matrix.

  • A character vector or string, which is used as a prefix for column names. Column numbers will be appended to the prefix.

  • true — Unique column names will be assigned using the format col1, col2, col3, etc.

  • false — Default. No column names are assigned.

Note

The column names do not need to be unique.

DMobj = DataMatrix(..., 'Name', NameValue, ...) specifies a name for DMobj. Default is ''.

DMobj = DataMatrix('File', FileName, ...'Delimiter', DelimiterValue, ...) specifies a delimiter symbol to use for the input file. Typical choices are:

  • ' '

  • '\t' (default)

  • ','

  • ';'

  • '|'

DMobj = DataMatrix('File', FileName, ...'HLine', HLineValue, ...) specifies which row of the input file contains the column header text (column names). HLineValue is a positive integer. Default is 1. When creating the DataMatrix object DMobj, the DataMatrix function loads data from (HLineValue + 1) to the end of the file.

Tip

If the input file does not contain column header text (column names), set HLineValue to 0.

DMobj = DataMatrix('File', FileName, ...'Rows', RowsValue, ...) specifies a subset of row names in File for the DataMatrix function to use to create DMobj. RowsValue can be a cell array of character vectors, a character array, string vector, or a numeric or logical vector.

DMobj = DataMatrix('File', FileName, ...'Columns', ColumnsValue, ...) specifies a subset of column names in File for the DataMatrix function to use to create DMobj. ColumnsValue can be a cell array of character vectors, string vector, character array, or numeric or logical vector.

Examples

For examples of creating and using DataMatrix objects, see Representing Expression Data Values in DataMatrix Objects.

Version History

Introduced in R2008b