How to exit a program or rather not process further code if a condition is not met ?
103 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Arthur
2012-11-21
Error should only be used when there is, ehm, an error. To stop the execution otherwise, use return.
2 个评论
更多回答(2 个)
Tonu
2012-11-21
1 个评论
Aishwarya Lakshmi Srinivasan
2021-3-8
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!