Search code examples
matlabterminate

How to terminate a running process in matlab?


I have a pretty simple question: how can I terminate a running script in matlab using code, similar to using CTRL + C?

I want the program to stop running if a user enters incorrect digits.


Solution

  • If in debug mode, you can use dbquit. if you're in the main function, return terminates and returns. Otherwise use the error function.