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 CenterFile Exchange에서 元胞数组에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!