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

1 vue (au cours des 30 derniers jours)
Samantha Chong
Samantha Chong le 12 Jan 2016
Commenté : Abhay khemka le 12 Fév 2019
Hi, I have an array of 80x2, 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.

Réponse acceptée

Walter Roberson
Walter Roberson le 12 Jan 2016
row_to_delete = all( cellfun(@(C) ischar(C) && strcmp(C,'N/A'), YourCell), 2);
YourCell(row_to_delete, :) = [];
  2 commentaires
Samantha Chong
Samantha Chong le 12 Jan 2016
Brilliant!!! thanks for that :))))
Abhay khemka
Abhay khemka le 12 Fév 2019
what is YourCell in this?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by