필터 지우기
필터 지우기

Or statement for input arguments of type 'cell'

조회 수: 1 (최근 30일)
hoda kazemzadeh
hoda kazemzadeh 2018년 6월 18일
댓글: hoda kazemzadeh 2018년 6월 18일
Hi, I want to compare two arguments of cell type which I read as readtable from a csv file (with header). I need to use Or statement but I get error that is not possible to do that.
T=readtable('r.csv')
if strcmp(T.first | T.second , 'NONE')==0
....
end
error: Undefined operator '|' for input arguments of type 'cell'
can you please me help me?

채택된 답변

Rik
Rik 2018년 6월 18일
The ismember function should help you out here, or you can use multiple calls to strcmp:
T=readtable('r.csv');
if ~( strcmp(T.first, 'NONE') || ...
strcmp(T.second, 'NONE') )
...
end
  댓글 수: 2
Jan
Jan 2018년 6월 18일
+1. If T.first and T.second are cell arrays, an any or all might be wanted. Or perhaps:
index = ~(strcmp(T.first, 'NONE') || strcmp(T.second, 'NONE'));
hoda kazemzadeh
hoda kazemzadeh 2018년 6월 18일
Thanks for your reply.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by