Main Content

Array2table.

Convert homogeneous array to table

描述

T.= array2table(一种converts them-by-N阵列,一种,到A.m-by-N表那T.。每列一种变成一个变量T.

Array2table.使用附加的输入数组名称在表中的变量名称中附加的列号。如果这些名称无效MATLAB®身份标识,Array2table.uses names of the form'var1',...,'varN',在哪里Nis the number of columns in一种

T.= array2table(一种名称,价值从数组创建一个表,一种那with additional options specified by one or more名称,价值pair arguments.

例如,您可以在表中指定要包含的行名称或变量名称。

例子

全部收缩

创建一个数字数据数组。

a = [1 4 7;2 5 8;3 6 9]
A =3×31 4 7 2 5 8 3 6 9

Convert the array,一种那to a table.

t = Array2table(a)
t =3×3表A1 A2 A3 __ __ __ 1 4 7 2 5 8 3 6 9

表具有将列编号附加到输入数组名称的变量名称,一种

创建一个数字数据数组。

A =[1 12 30.48; 2 24 60.96; 3 36 91.44]
A =3×31.0000 12.0000 30.4800 2.0000 24.0000 60.9600 3.0000 36.0000 91.4400

Convert the array,一种,到表并包括变量名称。

t = Array2table(a,......'variablenames'那{'脚''英寸''厘米'})
t =3×3表脚厘米厘米__________________1 12 30.48 2 24 60.96 3 36 91.44

输入参数

全部收缩

Input array, specified as a matrix.

数据类型:||INT8.|int16|int32|INT64.|uint8.|uint16|UINT32|UINT64|逻辑|char||塑造|细胞
复数支持:万博1manbetx

名称值对参数

指定可选的逗号分离对名称,价值arguments.名称是参数名称和Valueis the corresponding value.名称必须出现在引号内。您可以以任何顺序指定多个名称和值对参数名称1,Value1,...,NameN,ValueN

Example:'Rownames',{'row1','row2','row3'}使用行名称,row1row2那androw3对于桌子,T.

行名称T.,指定为逗号分隔的配对组成'rownames'和一个字符向量或字符串阵列的单元格数组,其元素是非空的和不同的。名称的数量必须等于行数,尺寸(a,1)

行名称可以有任何unicode®字符,包括空格和非ascii生产ers.

如果指定具有前导或尾随空格字符的行名称,那么Array2table.从行名称中删除它们。

变量名称T.,指定为逗号分隔的配对组成'variablenames'and a cell array of character vectors or a string array, whose elements are nonempty and distinct. The number of names must equal the number of variables,尺寸(a,2)

变量名称可以具有任何Unicode字符,包括空格和非ASCII字符。

输出参数

全部收缩

输出表,作为表返回。该表可以存储元数据,如描述,可变单位,变量名和行名称。有关更多信息,请参阅“属性”部分

T.ips

  • 如果一种是一个单元格阵列,使用细胞2table(A)从单元格中创建表一种。表中的每个变量是字符向量的数字或小区数组。Array2table(a)creates a table where each variable is a column of cells.

Compatibility Considerations

展开全部

R2019B的行为更改

扩展能力

Introduced in R2013b