table2array
Convert table to homogeneous array
Syntax
Description
A = table2array( converts an input table or
timetable to a homogeneous array. The variables in the input T)T
become columns in the output array A.
The output A does not include the table properties in
T.Properties.
If
Tis a table with row names, thenAdoes not include the row names.If
Tis a timetable, thenAdoes not include the row times.
Examples
Input Arguments
Tips
table2arrayhorizontally concatenates the variables inTto createA. If the variables inTare cell arrays,table2arraydoes not concatenate their contents, andAis a cell array, equivalent totable2cell(T). To create an array containing the contents of variables that are all cell arrays, usecell2mat(table2cell(T)).These syntaxes return the same array as
table2array(T).T{:,:}T.Variables, when the name of the second dimension of the table is the default name,'Variables'T.(T.Properties.DimensionNames{2}), when the name of the second dimension of the table is not'Variables'
Algorithms
If T contains variables with different data
types that are compatible for horizontal concatenation, table2array creates
a homogeneous array, A, of the dominant data type.
For example, if T contains double and single numeric
data, table2array(T) returns an array with data
type single.
Extended Capabilities
Version History
Introduced in R2013b