Main Content
assert
Throw error if condition false
Description
Examples
Input Arguments
Tips
When you issue an error, MATLAB captures information about it and stores it in a data structure that is an object of the
MException
class. You can access information in the exception object by usingtry/catch
. Or, if your program terminates because of an exception and returns control to the Command Prompt, you can useMException.last
.If an assertion failure occurs within a
try
block, MATLAB does not cease execution of the program. In this case, MATLAB passes control to thecatch
block.