MATLAB: How to exit a program or rather not process further code if a condition is not met

abort programif statement

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

Best Answer

Error should only be used when there is, ehm, an error. To stop the execution otherwise, use return.
Related Question