Skip to content

MException

Construct an exception object.

ME = MException(identifier, message)
ME = MException(identifier, message, v1, v2, ...)

Creates a structured exception object that can be examined or rethrown. Useful with try/catch for programmatic error handling. identifier is a string of the form 'Component:Tag'; message follows sprintf conventions.

ME = MException('MyApp:badRange', 'Value %d out of range', x)
throw(ME)
  • throw — Throw a previously-constructed exception.
  • error — Throw an error.
  • addCause — Attach a cause exception to a base exception.
  • getReport — Format an exception object as a string.