I am using the 'if' function to detect if a user inputs a number that is not 5 digits long. What I would like is a function that stops the script if a certain condition is met without displaying an error message.
"return" will terminate the current function and go back to the function that calls it. Is it possible then to stop running the entire script in GUI?
For example. A button's Callback function calls another function F. How to stop the Callback function as well if certain critieria in function F is met?
I think a 'msgbox' to really alert the user what is the issue, and then the 'error' funcition to stop the code would be a workaround. This way the user is aware that the issue is not really an 'error' when they see the red error font.
msg = "You've got a number that is not 5 digits long";
I wonder if it is possible to detect if the code is running in a try block. In such cases the message might be more confusing than simply throwing the error.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.