How to use throwascaller in MATLAB?

Use the throw or throwAsCaller function to have MATLAB ® issue the exception. At this point, MATLAB stores call stack information in the stack field of the MException, exits the currently running function, and returns control to either the keyboard or an enclosing catch block in a calling function.
For More Information Please Refer:
https://www.mathworks.com/help/matlab/matlab_prog/throw-an-exception.html
You May Also Like to Read: