我创建了3d Cell array" mycell"大小为1x100x19。
val(:,:,1) =
Columns 1 through 3
{3x1 cell} {3x1 cell} {3x1 cell}
Columns 4 through 6
{3x1 cell} {3x1 cell} {3x1 cell}
Columns 7 through 13
[] [] [] [] [] [] [].....
val(:,:,2) =
Columns 1 through 7
[] [] [] [] [] [] []
Columns 8 through 13
{3x1 cell} [] [] [] [] []......
等到mycell(:,:,19)。
由于我无法删除空行或列,我使用arrayfun连接如下:
mycell = arrayfun(@(x)cat(2, mycell{:,:,x}), 1:size(mycell, 3), 'uni', 0);
它给我这样的结果:
Columns 1 through 3
{3x6 cell} {3x1 cell} {3x73 cell} ....
结果还可以,但速度很慢。有什么方法可以用循环而不是arrayfun来做,因为我检查循环比arrayfun快。
任何帮助将不胜感激。