how to remove rows have ' - ' in their columns?

1 回表示 (過去 30 日間)
chocho
chocho 2017 年 5 月 20 日
編集済み: Jan 2017 年 5 月 21 日
Hi Friends, i have a cell array of size (37080*2) and i want to delete the rows have '-' in column 1 or 2.
cell={'gif','ghf';'feh','-';'ACACA','BRCA1';'-','TBCD';'NKX3-1','ATXN1'}
Output wanted={'gif','ghf';'ACACA','BRCA1';'NKX3-1','ATXN1'}
i have tried ismember and strcmp but i get only one column vector

採用された回答

Jan
Jan 2017 年 5 月 21 日
編集済み: Jan 2017 年 5 月 21 日
index = strcmp(C(:,1), '-') | strcmp(C(:,2), '-');
C(index, :) = [];
Or:
index = any(strcmp(C, '-'), 2);

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange元胞数组 についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!