I want to remove all empty cells at the bottom of a matlab cell array. However all code example that I found collapse the matrix to a vector, which is not what I want.
So this code
a = { 1, 2; 3, 4; [], []}
emptyCells = cellfun('isempty', a);
a(emptyCells) = []
results in this vector
a = [1] [3] [2] [4]
But I want instead this array
a =
[1] [2] [3] [4]
How would I do that?