How to exit a program or rather not process further code if a condition is not met ?
58 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Tonu
il 21 Nov 2012
Commentato: Aishwarya Lakshmi Srinivasan
il 8 Mar 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 Commenti
Risposta accettata
Arthur
il 21 Nov 2012
Error should only be used when there is, ehm, an error. To stop the execution otherwise, use return.
2 Commenti
Più risposte (2)
Tonu
il 21 Nov 2012
1 Commento
Aishwarya Lakshmi Srinivasan
il 8 Mar 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.
Vedere anche
Categorie
Scopri di più su Whos in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!