To stop the code execution during the running, you can use the following command in MATLAB:
main.m37 chars2 lines
This will throw an error and stop the execution immediately. You can modify the error message as per your requirement.
gistlibby LogSnag