MATLAB: How to delete the row that contains specific string on the cells

deleterowstring

Hi, I have an array of 80×2, and I would like to delete the rows only if both cells in a row contain the string 'N/A'. Attached is an example of the first 24 rows. The idea is I hope the code can find out which rows contain 2 'N/A', and then delete that corresponding row.

Best Answer

row_to_delete = all( cellfun(@(C) ischar(C) && strcmp(C,'N/A'), YourCell), 2);
YourCell(row_to_delete, :) = [];