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
    • loadobj
    • saveobj

loadobj — Restore an object payload produced during MAT-file loading.

loadobj(a) restores an object from a serialized object envelope. The load builtin calls this path automatically for objects saved by RunMat. When the saved class registers a static loadobj method, RunMat dispatches to it with the saved payload.

Syntax

b = loadobj(a)

Inputs

NameTypeRequiredDefaultDescription
aAnyYes—Serialized object representation.

Returns

NameTypeDescription
bAnyDeserialized object.

Errors

IdentifierWhenMessage
RunMat:ObjectSerialization:InvalidArgumentThe input is not an object or serialized object envelope.object serialization: invalid argument
RunMat:ObjectSerialization:DispatchA saveobj or loadobj method cannot be resolved or executed.object serialization: method dispatch failed
RunMat:ObjectSerialization:RecursionLimitObject serialization nesting exceeds the supported recursion limit.object serialization: recursion limit exceeded

How loadobj works

  • The public signature is b = loadobj(a).
  • RunMat recognizes object envelopes written by save and restores their payloads recursively.
  • If the saved class registers Class.loadobj, that method receives the restored payload and its return value becomes the loaded variable.
  • If no registered loadobj method exists and the payload is a scalar struct, RunMat reconstructs an object with the saved class name and payload fields as properties.
  • In RunMat mode, plain non-envelope scalar and cell inputs pass through recursive restoration unchanged; MATLAB-compatible modes reject this undocumented convenience through the loadobj-plain-payload-passthrough compatibility gate.
  • All eight integer classes nested in object or structure payloads retain their exact values, shape, signedness, and width through recursive restoration and class-specific loadobj dispatch.
  • Recursion is bounded and reports RunMat:ObjectSerialization:RecursionLimit for cyclic or excessively nested payloads.

Does RunMat run loadobj on the GPU?

loadobj does not launch provider kernels.

Loaded object properties are CPU-resident after MAT-file loading.

GPU memory and residency

loadobj creates host values. Downstream acceleration may later promote numeric properties through the usual RunMat Accelerate paths.

Examples

Load an object from a MAT-file

save('object_state.mat', 'obj');
clear obj;
load('object_state.mat')

Use class-specific static restoration

payload = saveobj(obj);
restored = classref('MyClass').loadobj(payload)

Using loadobj with coding agents

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

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

FAQ

Does load call loadobj automatically?⌄

Yes for object envelopes written by RunMat. load restores nested object payloads and calls registered static Class.loadobj methods when available.

What happens without a class-specific loadobj method?⌄

RunMat reconstructs a value object with the saved class name and property struct fields. If the saved payload was not a struct, the payload itself is returned.

Does this support arbitrary MATLAB object MAT-files?⌄

No. This support covers RunMat's own Level-5 object envelope and runtime object model. MATLAB v7.3/HDF5 class storage, object arrays, listener state, and handle alias preservation remain unsupported.

Related Oop functions

Serialization

saveobj

Indexing

numArgumentsFromSubscript · subsasgn · subsref

Open-source implementation

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

  • View the source for loadobj 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
  • Returns
  • Errors
  • How loadobj works
  • Does RunMat run loadobj on the GPU?
  • GPU memory and residency
  • Examples
  • Load an object from a MAT-file
  • Use class-specific static restoration
  • Using loadobj with coding agents
  • FAQ
  • Related Oop functions
  • Serialization
  • Indexing
  • Open-source implementation
  • About RunMat