MATLAB: Delete empty cell array

deletecellarray

Hi all,I have a problem regarding deletion in cell array.
The cell array is like A=
neigh node_id
[] [1]
[3X1] [2]
[5X1] [3]
[2X1] [4]
[] [5]
[9X1] [6]
Now, i want to delete the cells A{1,:} and A{5,:},as (A{1,1}=[] and A{5,1}=[]). Thus resulting array would be like:
A=
neigh node_id
[3X1] [2]
[5X1] [3]
[2X1] [4]
[9X1] [6]
the code
A = A(~cellfun('isempty', A)); is not able to work on this type of array A=cell(6,2).
Thanks

Best Answer

A = A(~any(cellfun('isempty', A), 2), :);