while loop question about the count
Mostrar comentarios más antiguos

I am wonder how can I make e become a change number because when I running my code e is always equal 5 even I changed my enter number? Thanks.
1 comentario
Yixuan Zhang
el 5 de Oct. de 2019
Editada: the cyclist
el 5 de Oct. de 2019
Respuestas (1)
KALYAN ACHARJYA
el 5 de Oct. de 2019
Editada: KALYAN ACHARJYA
el 5 de Oct. de 2019
I am wonder how can I make e become a change number because when I running my code e is always equal 5 even I changed my enter number? Thanks.
Because of While loop condition
PerValue>Pererror && e<5
%.....................^...
The while loop condition true, when PerValue>Pererror and e<5,
At 1st iter e=0+1
2nd iter e=2....
.....
when e=>5, the while loop becomes false, no stop the iteration at when e<5, irrespective of any changes within the loop
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!