Concatenate cell data in an array
2 次查看(过去 30 天)
显示 更早的评论
Good day,
I have got a cell which looks something like:
c{1} = [2 3
1 3
9 1
9 8
. .
. .]
c{2} = [1 2
3 1
. .
. .]
and so on.
Now I would like to vertically concatenate all data in one array.
The code I am using is:
total = []
for i = 1:size(c,2)
total = [total; c{i}];
end
This works fine, however Matlab suggests preallocation for speed. However, I don't know how to do that in this example.
Thank you in advance.
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!