how to stop executing while loop?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ramesh Singh
el 28 de Oct. de 2020
Comentada: Ramesh Singh
el 28 de Oct. de 2020
x=1;
while x>0
x+1
end
2 comentarios
KSSV
el 28 de Oct. de 2020
This is an infinite loop...it will not stop....to force stop use ctrl + c .
Respuesta aceptada
KSSV
el 28 de Oct. de 2020
You can set a condition like below and exit the while loop.
x=1;
while x<10
x = x+1 ;
end
0 comentarios
Más respuestas (1)
Alan Stevens
el 28 de Oct. de 2020
Use a condition inside the while loop, such as
if x>10, break, end
0 comentarios
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!