RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

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.

/
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

message
Type
StringScalar
Required
Yes
Description
Error message text.
message
Type
StringScalar
Required
Yes
Description
Error message template text.
A
Type
Any
Required
Variadic
Description
Formatting values for the message template.
message_id
Type
StringScalar
Required
Yes
Description
Message identifier.
msg_struct
Type
Any
Required
Yes
Description
Struct containing identifier/message fields.
correction
Type
Any
Required
Yes
Description
MATLAB correction object.
messageArguments
Type
Any
Required
Variadic
Description
Identifier, message, and optional formatting values.
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

RunMat:error
When
No arguments are supplied.
Message
error: missing message argument
RunMat:error
When
Additional arguments are supplied after an MException input.
Message
error: additional arguments are not allowed when passing an MException
RunMat:error
When
Additional arguments are supplied after a message-struct input.
Message
error: additional arguments are not allowed when passing a message struct
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

Behavior and placement

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 must be scalar and contain at least one of message, identifier, or stack. RunMat accepts message and identifier independently; explicit stack reconstruction is deferred because RuntimeError does not yet accept MATLAB stack structures.

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

The legacy examples' prose outcomes describe the thrown diagnostic; error calls do not print a successful display result.

Examples

Throw a formatted error with an identifier

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

Format an exact typed integer

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

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

Source you can read

Every RunMat function's source is public. 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 a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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
  • Behavior and placement
  • Examples
  • Throw a formatted error with an identifier
  • Format an exact typed integer
  • Using error with coding agents
  • FAQ
  • Related Diagnostics functions
  • Source you can read
  • About RunMat