RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • assert
    • error
    • rethrow
    • runtests
    • warning

error — Throw an error with optional identifier and formatted message values.

error constructs a diagnostic message and transfers control to the nearest compatible catch boundary. A one-input message is literal; multi-input forms decode documented escapes and apply sprintf-style formatting before throwing.

Syntax

error(msg)
error(msg, A)
error(errID, ___)
error(errorStruct)
error(correction, ___)

Inputs

NameTypeRequiredDefaultDescription
messageStringScalarYes—Error message text.
messageStringScalarYes—Error message template text.
AAnyVariadic—Formatting values for the message template.
message_idStringScalarYes—Message identifier.
msg_structAnyYes—Struct containing identifier/message fields.
correctionAnyYes—MATLAB correction object.
messageArgumentsAnyVariadic—Identifier, message, and optional formatting values.

Errors

IdentifierWhenMessage
RunMat:errorNo arguments are supplied.error: missing message argument
RunMat:errorAdditional arguments are supplied after an MException input.error: additional arguments are not allowed when passing an MException
RunMat:errorAdditional arguments are supplied after a message-struct input.error: additional arguments are not allowed when passing a message struct
RunMat:errorMessage struct contains none of message, identifier, or stack.error: message struct must contain 'message', 'identifier', or 'stack'
RunMat:errorMessage struct requests an explicit MATLAB stack that cannot be represented yet.error: explicit errorStruct stack is not supported yet
RunMat:errorIdentifier/message inputs or format arguments are not string-compatible.error: invalid input argument
RunMat:errorIdentifier fields do not follow documented colon-separated identifier grammar.error: invalid error identifier
RunMat:errorA documented matlab.lang.correction object is supplied before correction objects are representable.error: matlab.lang.correction objects are not supported yet

How error works

  • error(msg) throws the literal text scalar without converting escape or format sequences.
  • error(msg,A) and error(errID,___) decode escape sequences, format replacement values, and then throw.
  • Documented error identifiers use colon-separated fields that each begin with a letter and otherwise contain only letters, digits, or underscores.
  • All eight integer classes are documented numeric formatting values. RunMat keeps typed integers authoritative through integer conversion specifiers, including uint64 values above binary64's exact range.
  • If every supplied input is an empty array, the call is a no-op and does not throw.
  • error(MException), unqualified identifier normalization, and the messageid or msg structure aliases are independent RunMat-only extensions and reject in MATLAB compatibility mode.
  • The documented matlab.lang.correction object families are not yet representable in RunMat and currently raise an explicit unsupported diagnostic.
  • An errorStruct can use message and identifier fields independently. Explicit errorStruct stack reconstruction is deferred because RuntimeError does not yet accept MATLAB stack structures.

GPU memory and residency

Formatting values gather to host after message and identifier validation; error is a host control-flow operation.

Examples

Throw a formatted error with an identifier

error('MyComponent:incorrectType','Input must be a char, not a %s.',class(x))

Expected output:

Throws an exception with identifier `MyComponent:incorrectType`.

Format an exact typed integer

error('Value is %u',uint64(18446744073709551615))

Expected output:

The integer conversion uses authoritative uint64 storage before the diagnostic is thrown.

Using error with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how error changes the result.

Run a small error example, explain the result, then change one input and compare the output.

FAQ

Does error execute on the GPU?⌄

No. MathWorks documents GPU-array inputs, but the function does not run on the GPU. RunMat gathers valid formatting values and throws from the host.

Are suggested corrections implemented?⌄

Not yet. RunMat does not currently model the three matlab.lang.correction object classes, so correction-object calls report the infrastructure gap explicitly.

Does errorStruct preserve an explicit stack?⌄

Not yet. Message and identifier fields are supported, but translating MATLAB stack structure arrays into RuntimeError call frames remains deferred.

Related Diagnostics functions

assert · rethrow · runtests · warning

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how error is executed, line by line, in Rust.

  • View the source for error in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Errors
  • How error works
  • GPU memory and residency
  • Examples
  • Throw a formatted error with an identifier
  • Format an exact typed integer
  • Using error with coding agents
  • FAQ
  • Related Diagnostics functions
  • Open-source implementation
  • About RunMat