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 日間)
古いコメントを表示
Sohaib Bin Altaf
2017 年 7 月 13 日
コメント済み: Sohaib Bin Altaf
2017 年 7 月 13 日
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!