I am writing a code and I get the error 'Operands to the || and && operators must be convertible to logical scalar values'... it is an If statement in multiple loops, when the IF has 4 conditions it works fine but at 5th it gives error..
조회 수: 2 (최근 30일)
이전 댓글 표시
works fine with other 4 conditions but when I add another that is data{i,4}==Device(dev) it does not work...
x=[23:1:36]
y=[-30:-1:-32]
APs=[1 2 3 4 12 13]
Dir=[1 2 3 4]
Device=[353111088717176 353111088716343 869090028476779]
p=1;
s=1;
for xx=1:1:length(x)
for yy=1:1:length(y)
for kk=1:1:length(APs)
for dd=1:1:length(Dir)
for dev=1:1:3
for i=1:1:length(data)
if data{i,2}== x(xx) && data{i,3}== y(yy) && data{i,4}==Device(dev) && data{i,5}== APs(kk) && data{i,6}==Dir(dd) ;
point(p,s,kk,dd)=data{i,8};
p=p+1;
end
end
p=1;
end
end
end
s=s+1;
end
end
댓글 수: 0
채택된 답변
Walter Roberson
2017년 7월 13일
Your data is a cell array, and data{i,4} is a vector or array, possibly a character vector. If you are trying to compare strings you should be using strcmp()
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!