文档

vertcat

垂直串联阵列

句法

c = vertcat(a1,...,an)

描述

c = vertcat(a1,...,an)垂直串联阵列A1,...,一个。参数列表中的所有数组必须具有相同数量的列。

  • 如果输入是多维阵列,vertcat沿着第一维的串联n维数组。其余的尺寸必须匹配。

  • If the inputs are tables,vertcat通过匹配变量名称的串联。除顺序外,所有表的可变名称都必须相同。当存在时,行名称必须在桌子上是唯一的。

    vertcatfills in default row names when some of the inputs have names and some do not.vertcat分配每个表属性的值(除了隆起)使用表中的相应属性的第一个非空值A1,...,一个

    如果输入是时间表,则列名必须相同。

vertcat还串联字符阵列。每个被串联的数组必须具有相同数量的字符。

MATLAB®呼叫c = vertcat(a1,a2,...)对于语法c = [a1;A2;...]]当任何输入是对象时。

尖端

To concatenate categorical arrays, see结合分类阵列

If all the input arrays are ordinal categorical arrays, they must have the same sets of categories including their order. For more information, see顺序分类阵列

您可以将DateTime数组与字符数组的单元格数在一起。

您可以连接持续时间阵列和日历持续时间阵列。结果是日历持续时间数组。

您可以与数字阵列连接持续时间或日历持续时间数组。在串联之前,MATLAB使用该数字阵列将数字阵列转换为等效天数的阵列功能。

您可以将字符串数组与数字阵列,逻辑数组,字符向量或单元格数组相连。首先将非弦数阵列转换为字符串数组,并将输出作为字符串数组返回。

有关组合与整数类型不同的信息,具有非智能器的整数,具有非细胞数组的单元格数或与其他元素的空矩阵,请参见与课程不同的有效组合

例子

全部收缩

Create a 5-by-3 matrix,一种

a =magic(5); A(:, 4:5) = []
a =17 24 1 23 5 7 4 6 13 10 12 19 11 18 25

创建一个3 x-3矩阵,b

b =魔术(3)*100
b=800 100 600 300 500 700 400 900 200

垂直连接一种andb

c = vertcat(a,b)
C=17 24 1 23 5 7 4 6 13 10 12 19 11 18 25800 100 600 300 500 700 400 900 200

Create a table,一种,有三行和五个变量。

a =table([5;6;5],['M';'M';'M'],[45;41;40],[45;32;34],{'ny';'ca';'MA'},,...'variablenames',{'Age''性别''Height''重量''出生地'},,...'Rownames',{'Thomas''Gordon'“珀西”})
a =3x5 tableAge Gender Height Weight Birthplace ___ ______ ______ ______ __________ Thomas 5 M 45 45 'NY' Gordon 6 M 41 32 'CA' Percy 5 M 40 34 'MA'

Create a table,b,具有与一种除了订单。

b =表(['F';'M';'F'],[6; 6; 5],{'AZ';'NH';'CO'},,[31;42;33],[39;43;40],...'variablenames',{'性别''Age''出生地''重量''Height'})
b =3x5 tableGender Age Birthplace Weight Height ______ ___ __________ ______ ______ F 6 'AZ' 31 39 M 6 'NH' 42 43 F 5 'CO' 33 40

垂直连接tables一种andb

c = vertcat(a,b)
C =6x5表Age Gender Height Weight Birthplace ___ ______ ______ ______ __________ Thomas 5 M 45 45 'NY' Gordon 6 M 41 32 'CA' Percy 5 M 40 34 'MA' Row4 6 F 39 31 'AZ' Row5 6 M 43 42 'NH'Row6 5 F 40 33'Co'

变量C与变量的顺序相同一种和默认行名用于行的行b

扩展功能

也可以看看

|

话题

Introduced before R2006a

Was this topic helpful?