MATLAB: Delete rows from cell array

cell arraysdelete row

I have a cell array of 11×8761 and I want to delete entire rows when the value in column 9 or 6 are equal to []. How do I delete the rows without deleting the entire column as well?

Best Answer

emptycells = cellfun(@isempty, yourcellarray); %find empty cells in the whole cell array
yourcellarray(any(emptycells(:, [6 9]), 2), :) = []; %remove rows for which any of column 6 or 9 is empty