How to stop a script if conditions are met.
2.068 views (last 30 days)
Show older comments
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.
P.S. I'm very new to MATLAB.
1 Comment
Jingyang Xie
on 6 Jan 2021
Hi Cory, have you solved this problem? I think I encountered the same problem...
Accepted Answer
More Answers (1)
Hamid Ramezani
on 30 Sep 2019
you may use "error" function instead of return
3 Comments
Rik
on 10 Dec 2020
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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!