Combine two cell arrays

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일

0 개 추천

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일

0 개 추천

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{:}]

카테고리

도움말 센터File Exchange에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by