How to exit a program or rather not process further code if a condition is not met ?
238 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tonu
el 21 de Nov. de 2012
Comentada: Aishwarya Lakshmi Srinivasan
el 8 de Mzo. de 2021
Say for example a check for a variable 'a' ?
If a is not equal to (a~= 1) abort the program and do not execute further codes , else continue ?
Thanks,
Tonu
0 comentarios
Respuesta aceptada
Arthur
el 21 de Nov. de 2012
Error should only be used when there is, ehm, an error. To stop the execution otherwise, use return.
2 comentarios
Más respuestas (2)
Tonu
el 21 de Nov. de 2012
1 comentario
Aishwarya Lakshmi Srinivasan
el 8 de Mzo. de 2021
Hi, can you please elaborate this ? In my case I am trying to abort a function that is currently running by setting the flag to false when abort button is pressed in an app designer.
Ver también
Categorías
Más información sobre Startup and Shutdown 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!