MATLAB: Does the output of CELL2MAT have fewer elements than the cell array that I pass in

argumentcellcell2matemptylengthMATLABoutputsize;

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);

Best Answer

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.
Related Question