matlab - 如何在 MATLAB 中将元胞数组的元胞数组合并为单个元胞数组

标签 matlab concatenation cell-array

我有一个(字符串)元胞数组的动态元胞数组,我想将它组合成一个字符串元胞数组。

示例:

Columns 1 through 4
{4x1 cell}    {9x1 cell}    {8x1 cell}    {10x1 cell} 

我想连接内部单元格,结果是一个单元格数组的形式

{31x1 cell}.

如何不使用 for 循环 连接成一个元胞数组?

谢谢

最佳答案

使用 vertcat ...

cellarr = {cell(4,1), cell(9,1), cell(8,1), cell(10,1)};
merged = vertcat(cellarr{:});

关于matlab - 如何在 MATLAB 中将元胞数组的元胞数组合并为单个元胞数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45073666/

相关文章:

matlab - Octave /Matlab : PCA on sparse matrix: how to get only the most important eigenvectors?

python - 快速 python 前端列表扩展

matlab - 如何应用带有常量额外输入参数的 cellfun(或 arrayfun 或 structfun)?

file - Cordova 替代 UNIX cat 命令

python - 将数据帧合并到有序列表中

MATLAB:如何检查元胞元素是否已存在于元胞数组中?

matlab - 创建新的元胞数组矩阵

c - 如何使用 Embedded Coder 在 MATLAB 中内联 Level-2 .m S-Functions

matlab - Mathworks 生成 Matlab HTML 文档的方法是什么?

matlab - 用 NaN 替换矩阵的某些元素 (MATLAB)