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..
1 次查看(过去 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 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!