Cell2Mat for multiple columns

5 次查看(过去 30 天)
If I have the 2x3x4 cell array:
g = cat(3, {1,2,3;4,5,6}, {11,12,13;14,15,16}, {21,22,23;24,25,26}, {31,32,33;34,35,36})
What is the best way to wrap this into a 2D matrix such that the matrix has 2 columns and 12 rows in each?
The first column would consist of 1,2,3,11,12,13,21,22,23,31,32,33 // The second column 4,5,6,14,15,16,24,25,26,34,35,36
Something like:
AllFrag = reshape(cell2mat(g),2,[]).'
Throws an error:
Error in cell2mat (line 119)
ct{mref{:}} = cat(cdim+1,c{mref{:},:});
and I'm not sure why.

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2014-10-15

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by