Combine two cell arrays

1 次查看(过去 30 天)
I have two cell arrays:
X{1,1}=[18;21;17;20;19];
X{1,2}=cellstr(['m';'f';'m';'m';'f']);
How to create new cell array like this:
Z=[X{1,1}(:,:) X{1,2}(:,:)]

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-8-10
编辑:Azzi Abdelmalek 2013-8-10
Maybe you want
X=[num2cell([18;21;17;20;19]) cellstr(['m';'f';'m';'m';'f'])]

更多回答(1 个)

Andrei Bobrov
Andrei Bobrov 2013-8-10
编辑:Andrei Bobrov 2013-8-10
X{1,1}=num2str([18;21;17;20;19]);
X{1,2}=cellstr(['m';'f';'m';'m';'f']);
strcat(X{:})
OR
X{1,1}=num2cell([18;21;17;20;19]);
X{1,2}=cellstr(['m';'f';'m';'m';'f']);
[X{:}]

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by