How can I stop the program? "Break" - Error

17 visualizaciones (últimos 30 días)
João Carvalho
João Carvalho el 26 de Oct. de 2017
Comentada: Walter Roberson el 26 de Oct. de 2017
I am using a "Break" to stop the program but it is showing an error. How can I solve that and stop the program? Thanks

Respuesta aceptada

OCDER
OCDER el 26 de Oct. de 2017
break is used to break a for or while loop. Use return instead to end the function. Use error(some error message) to completely end the program due to an error.
  1 comentario
Walter Roberson
Walter Roberson el 26 de Oct. de 2017
Use pause() to have the program wait for you to press a key. Use keyboard() to have the program switch to command mode without exiting the function.

Iniciar sesión para comentar.

Más respuestas (1)

Birdman
Birdman el 26 de Oct. de 2017
Break is used to stop for or while loops. Just throw an error by typing:
error('Break');

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by