将许多单元阵列组合成一个单元阵列(Matlab) [英] Combine many cell arrays into one cell array (Matlab)
本文介绍了将许多单元阵列组合成一个单元阵列(Matlab)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有3个单元格数组:
c1={'a','b','c'}
c2={'a2','b2','c2'}
c3={'a3','b3','c3'}
如何将这3个单元格阵列合并为1个单元格C,如下所示:
How can I combine those 3 cell arrays into 1 cell array C as follows:
C={'a','b','c','a2','b2','c2','a3','b3','c3'}
推荐答案
您可以简单地使用方括号;
You can simply use square brackets;
c = [c1, c2, c3]
% c = {'a' 'b' 'c' 'a2' 'b2' 'c2' 'a3' 'b3' 'c3'}
在将项目附加到单元格的末尾,
This can be used when appending items to the end of a cell too,
d1 = {'a', 'b', 'c', 'd'};
d2 = [d1, {'e'}];
这篇关于将许多单元阵列组合成一个单元阵列(Matlab)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文