How to delete the row that contains specific string on the cells
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Samantha Chong
il 12 Gen 2016
Commentato: Abhay khemka
il 12 Feb 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153211/image.jpeg)
0 Commenti
Risposta accettata
Walter Roberson
il 12 Gen 2016
row_to_delete = all( cellfun(@(C) ischar(C) && strcmp(C,'N/A'), YourCell), 2);
YourCell(row_to_delete, :) = [];
2 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Numeric Types in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!