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 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sohaib Bin Altaf
el 13 de Jul. de 2017
Comentada: Sohaib Bin Altaf
el 13 de Jul. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 13 de Jul. de 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()
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!