MATLAB: Delete empty cells from cell array

cell arrays

Untitled.png
how to delete the empty cells and get back 4×4 matrix
i tried
out = ca(~cellfun('isempty', ca));
but i'm getting output as vector. I need it as matrix format

Best Answer

reshape(out,4,[])