MATLAB: Convert cell array to an array, when the size of the cells is different

cell2mat

Hi all,
I have a cell array like this A={ [0 0 0 0] ; [1 1] ;[2] }
Is it possible to convert it in an array? I tried with cell2mat but I get an error because the sizes are different
thanks
Nikolas

Best Answer

Download padcat:
and use it like this:
>> M = padcat(A{:})
M =
0 0 0 0
1 1 NaN NaN
2 NaN NaN NaN