FUNCTION REFERENCE

error

Raise an error with a message and optional identifier.

Raise an error with a message and optional identifier.

Syntax

error(message)

Syntax

error(format, values...)

Syntax

error(identifier, format, values...)

Syntax

error(errStruct)

Stops the current block unless an enclosing try/catch handles the error. An identifier such as 'Demo:bad' must be followed by a message. A scalar error struct needs a character message and may include a character identifier. An empty message takes no action. Formatted messages are limited to 65536 UTF-8 bytes; unsupported formatting is rejected.

Example

try; error('A:b','v=%d',5); catch err; disp(err.message); end   % v=5

Differences from MATLAB: MatRust uses error structs with an empty stack; MException objects are not supported.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.