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

1 vue (au cours des 30 derniers jours)
chocho
chocho le 20 Mai 2017
Modifié(e) : Jan le 21 Mai 2017
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

Réponse acceptée

Jan
Jan le 21 Mai 2017
Modifié(e) : Jan le 21 Mai 2017
index = strcmp(C(:,1), '-') | strcmp(C(:,2), '-');
C(index, :) = [];
Or:
index = any(strcmp(C, '-'), 2);

Plus de réponses (0)

Catégories

En savoir plus sur 元胞数组 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!