What is wrong with this loop?
Mostrar comentarios más antiguos
for kn=1:199
for snn=1:6591
for sn=1:3
if x1c{kn+1,1}(snn,sn)-x1c{kn,1}(snn,sn)>20
x1c{kn+1,1}(snn,sn)=x1c{kn+1,1}(snn,sn)+40; %EXTENDED POSITION(1)
elseif x1c{kn+1,1}(snn,sn)-x1c{kn,1}(snn,sn)<-20
x1c{kn+1,1}(snn,sn)=x1c{kn+1,1}(snn,sn)-40; %EXTENDED POSITION(2)
else
x1c{kn+1,1}(snn,sn)=x1c{kn+1,1}(snn,sn);
end
end
end
end
It doesn't give any error, but I think it does do something wrong.
1 comentario
Matthew Eicholtz
el 29 de Feb. de 2016
If it doesn't give any error, then the only way to know if it is doing something wrong is to know what the purpose of the code is in the first place. So, what do you expect the code to do?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!