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
    • numArgumentsFromSubscript
    • subsasgn
    • subsref

subsasgn — Dispatch overloaded object assignment operations to class-specific Class.subsasgn implementations.

subsasgn(obj, kind, payload, rhs) is the internal dispatch builtin for overloaded indexed assignment on objects. MATLAB-style assignment syntax lowers to this mechanism, which resolves class-specific Class.subsasgn handlers.

Syntax

obj = subsasgn(obj, kind, payload, rhs)

Inputs

NameTypeRequiredDefaultDescription
objAnyYes—Object receiver.
kindStringScalarYes—Indexing kind token ('()', '{}', '.').
payloadAnyYes—Indexing payload.
rhsAnyYes—Assigned value.

Returns

NameTypeDescription
objAnyUpdated object value.

Errors

IdentifierWhenMessage
RunMat:InvalidObjectDispatchReceiver is not an object or handle object.subsasgn: requires object receiver
RunMat:MissingSubsasgnTarget class does not implement subsasgn.subsasgn: class does not define subsasgn for indexed assignment

How subsasgn works

  • The receiver must be an object or handle object.
  • The kind argument selects the assignment form: '.', '()', or '{}'.
  • For dot assignment, payload is typically a field/property name string.
  • For () and {} assignment, payload is typically a cell array of indices.
  • The builtin forwards the assignment to the receiver's class-specific Class.subsasgn implementation and returns the updated object value.
  • Integer selectors and assigned values retain their native class, exact value, shape, and resident handle during dispatch. The class method owns assignment conversion, overflow, and returned-receiver semantics.
  • Prefer normal assignment syntax in user code; direct calls to subsasgn are mainly useful for advanced dispatch or testing.

Does RunMat run subsasgn on the GPU?

subsasgn performs no provider dispatch; it forwards assignment requests to the appropriate class-specific host implementation.

GPU memory and residency

subsasgn is host-side object dispatch and does not itself manage GPU residency.

Examples

Change a datetime display format explicitly

t = datetime(2024, 4, 9);
t = subsasgn(t, ".", "Format", "yyyy-MM-dd");
disp(t)

Expected output:

2024-04-09

Replace one element of a datetime array explicitly

t = datetime([2024 2025], [1 6], [15 20]);
t = subsasgn(t, "()", {2}, datetime(2030, 1, 1));
disp(t)

Expected output:

15-Jan-2024 00:00:00
01-Jan-2030 00:00:00

Using subsasgn with coding agents

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

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

FAQ

Should I call subsasgn directly in normal code?⌄

Usually no. Prefer ordinary assignment syntax like obj.field = value or obj(2) = value. Direct calls are mainly for advanced dispatch and testing.

What values can kind take?⌄

RunMat's object-dispatch path expects '.', '()', or '{}'.

What does the global subsasgn actually do?⌄

It resolves the receiver's class and forwards the assignment to that class's Class.subsasgn implementation.

Related Oop functions

Indexing

numArgumentsFromSubscript · subsref

Serialization

loadobj · saveobj

Open-source implementation

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

  • View the source for subsasgn 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 subsasgn works
  • Does RunMat run subsasgn on the GPU?
  • GPU memory and residency
  • Examples
  • Change a datetime display format explicitly
  • Replace one element of a datetime array explicitly
  • Using subsasgn with coding agents
  • FAQ
  • Related Oop functions
  • Indexing
  • Serialization
  • Open-source implementation
  • About RunMat