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

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact
  • License
  • Privacy

Learn

  • Docs
  • Blog
  • Benchmarks
  • RunMat vs MATLAB Online

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.

/
See all docs
Builtin Reference
    • addprop
    • assignin
    • class
    • clear
    • clearAllMemoizedCaches
    • clearCache
    • clearvars
    • dbclear
    • dbstack
    • dbstatus
    • dbtype
    • evalc
    • feval
    • findprop
    • getcallinfo
    • inputParser
    • isa
    • ischar
    • isdeployed
    • iskeyword
    • ismethod
    • isobject
    • isstring
    • isUnderlyingType
    • keyboard
    • matlab.metadata.DynamicProperty.delete
    • memoize
    • metaclass
    • mislocked
    • mlock
    • munlock
    • namelengthmax
    • narginchk
    • nargoutchk
    • notify
    • onCleanup
    • stats
    • str2func
    • superclasses
    • underlyingType
    • verLessThan
    • version
    • which
    • who
    • whos

assignin — Assign an already evaluated value to a variable in the base or caller workspace.

assignin(ws, var, val) assigns the already evaluated value val to the variable named by var in the base or caller workspace. The function creates the variable when necessary and has no public output.

Syntax

assignin(workspace, name, value)

Inputs

NameTypeRequiredDefaultDescription
workspaceStringScalarYes—`base` or `caller` workspace selector.
nameStringScalarYes—Workspace variable name.
valueAnyYes—Value to assign into the selected workspace.

Errors

IdentifierWhenMessage
RunMat:DynamicWorkspaceRequiresVmA dynamic workspace builtin is dispatched outside the VM workspace frame.dynamic workspace builtin requires VM workspace context
RunMat:assignin:TooManyOutputsOne or more outputs are requested from assignin.assignin: too many output arguments
RunMat:DynamicWorkspaceNameThe variable-name argument is not a valid MATLAB variable name.assignin: invalid workspace variable name

How assignin works

  • ws is a character vector or string scalar selecting the base or caller workspace. At the command prompt those workspaces are equivalent; inside a function, caller selects the workspace of the calling function.
  • var is a character vector or string scalar containing one valid variable name, not an indexed expression. A valid name starts with an English letter, continues with English letters, digits, or underscores, is not a language keyword, and contains at most namelengthmax characters.
  • val can have any data type and can be scalar or array valued. Expressions are evaluated in the function containing the call before the resulting value is assigned.
  • Integer values retain their exact class, shape, and authoritative storage. Wide uint64 values are not converted through double.
  • Assignment is structural: resident values retain provider ownership without gather, re-upload, or numeric computation.
  • The public function has no output. Requesting an output raises RunMat:assignin:TooManyOutputs.

Does RunMat run assignin on the GPU?

assignin performs no numerical operation. A GpuTensor is cloned into the selected workspace as the same provider-owned value, so class, shape, exact integer payload, and residency remain unchanged and no kernel or host transfer occurs.

Examples

Export an exact integer array to the base workspace

function publishCounts(counts)
    assignin("base", "counts", uint64(counts))
end

Change a variable in the calling function

function outer
    age = 37;
    updateCaller;
    disp(age)
end

function updateCaller
    assignin("caller", "age", 42)
end

Assign an evaluated expression rather than source text

function publishResult(A)
    result = sum(A, "native");
    assignin("base", "result", result)
end

Using assignin with coding agents

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

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

FAQ

Does assignin evaluate val in the destination workspace?⌄

No. The expression producing val is evaluated in the function containing the assignin call, and the resulting value is then transferred to the selected workspace.

Can var contain indexing such as A(3)?⌄

No. assignin assigns a whole workspace variable. Use evalin when destination-workspace indexed assignment is unavoidable.

Are integer arrays converted to double?⌄

No. Assignment preserves exact integer class, shape, and values, including uint64 values above flintmax.

Does a GPU value move to the CPU?⌄

No. RunMat transfers the value object structurally and retains its provider-owned resident representation.

What value does assignin return?⌄

It has no public output. Assigning its call result is an error.

Related Introspection functions

addprop · class · clear · clearAllMemoizedCaches · clearCache · clearvars · dbclear · dbstack · dbstatus · dbtype · evalc · feval · findprop · getcallinfo · inputParser · isa · ischar · isdeployed · iskeyword · ismethod · isobject · isstring · isUnderlyingType · keyboard · matlab.metadata.DynamicProperty.delete · memoize · metaclass · mislocked · mlock · munlock · namelengthmax · narginchk · nargoutchk · notify · onCleanup · stats · str2func · superclasses · underlyingType · verLessThan · version · which · who · whos

Open-source implementation

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

  • View the source for assignin 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 assignin works
  • Does RunMat run assignin on the GPU?
  • Examples
  • Export an exact integer array to the base workspace
  • Change a variable in the calling function
  • Assign an evaluated expression rather than source text
  • Using assignin with coding agents
  • FAQ
  • Related Introspection functions
  • Open-source implementation
  • About RunMat