condition in while loop
Mostrar comentarios más antiguos
while ((ch1(1,1)~=60)&(ch1(1,2)~=40)) ||
((ch2(1,1)~=60)&(ch2(1,2)~=40)) ||
((ch3(1,1)~=60)&(ch3(1,2)~=40)) ||
((ch4(1,1)~=60)&(ch4(1,2)~=40)))
body
end
hi,
i want to run a loop until any one of the condition ch1(60,40),ch2(60,40),ch3(60,40),ch4(60,40) met. is above syntax is correct or not. i run the above line but didn't get proper response which is desired.
kindly help me. i will be highly thankful to you :) thanks in advance
4 comentarios
Mudasir Ahmed
el 5 de Oct. de 2014
Editada: Image Analyst
el 5 de Oct. de 2014
Jan
el 5 de Oct. de 2014
Editada: Image Analyst
el 5 de Oct. de 2014
I've formatted the code (use the "{} Code" button). Then it gets obvious, that there is one extra closing parenthesis.
I cannot guess what "the condition ch1(60,40)" means. So all we see is the code but we do not know, what you expect it to do. This is not enought to suggest changes.
Geoff Hayes
el 6 de Oct. de 2014
Mudasir - from your previous question at ga & target tracking, the (60,40) is the position of the target, the ch1, ch2, ch3, and ch4 are presumably the chromosomes of your population (of only size four?). And each chromosome has two genes (or variables). Are you trying to force a genetic algorithm to run until one of the chromosomes has converged on the target position? That won't necessarily (or even probably) happen given the small population size and the fact that the solutions may all converge prematurely to another location.
Mudasir Ahmed
el 6 de Oct. de 2014
Respuesta aceptada
Más respuestas (2)
per isakson
el 6 de Oct. de 2014
while ((ch1(1,1)~=60)&&(ch1(1,2)~=40)) || ...
((ch2(1,1)~=60)&&(ch2(1,2)~=40)) || ...
((ch3(1,1)~=60)&&(ch3(1,2)~=40)) || ...
((ch4(1,1)~=60)&&(ch4(1,2)~=40))
body
end
Mudasir Ahmed
el 6 de Oct. de 2014
0 votos
1 comentario
Geoff Hayes
el 6 de Oct. de 2014
Mudasir - as your answer isn't an answer to your original question (but three new questions!) then you should delete this answer and start a new thread, or continue the conversation at a previous post of yours, GAs and target tracking, so that readers of this thread do not become confused.
Categorías
Más información sobre Quadratic Programming and Cone Programming 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!