How to effectively concatenate values in cells with different dimension into single column double
2 次查看(过去 30 天)
显示 更早的评论
Dear Coder,
I have cells with diffrent dimension, for example cell {1}=[1 2 3], cell {2}=[ 4 5 6 7 8] cell{3}=[9 10]. How can I concatenate the value within each cell into a single row, such that, row_doub=[1 2 3 4 5 6 7 8 9 10]. Any suggestion is greatly appreciate.
0 个评论
采纳的回答
OCDER
2017-9-29
C{1} = [1 2 3];
C{2} = [4 5 6 7 8];
C{3} = [9 10];
D = cat(2, C{:});
D =
1 2 3 4 5 6 7 8 9 10
2 个评论
OCDER
2017-9-29
You're Welcome! If you want to learn more about how this works, here's a link for using comma-separated lists - quite a neat trick in Matlab
For instance, this also works:
D = [C{:}]
更多回答(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!