Why does the output of CELL2MAT have fewer elements than the cell array that I pass in?
3 views (last 30 days)
Show older comments
I pass in a cell array to the CELL2MAT function but the output matrix has less elements than the cell array. For example, if the cell array has 10 cells but 2 cells are empty, then when this cell array is passed into CELL2MAT, the output matrix will only have 8 elements.
c = {1,2,3,4,5,[],[],8,9,10};
m = cell2mat(c);
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This is expected behavior of the function CELL2MAT. when the cell array contains empty cells, the matrix generated will not contain the elements empty cells.
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!