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 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sohaib Bin Altaf
il 13 Lug 2017
Commentato: Sohaib Bin Altaf
il 13 Lug 2017
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 Commenti
Risposta accettata
Walter Roberson
il 13 Lug 2017
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()
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!