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

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.

 採用された回答

Walter Roberson
Walter Roberson 2016 年 1 月 12 日

1 投票

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

2 件のコメント

Samantha Chong
Samantha Chong 2016 年 1 月 12 日
Brilliant!!! thanks for that :))))
Abhay khemka
Abhay khemka 2019 年 2 月 12 日
what is YourCell in this?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by