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
    • addlistener
    • addParameter
    • addprop
    • assignin
    • builtin
    • cancel
    • class
    • clear
    • clearAllMemoizedCaches
    • clearCache
    • clearvars
    • dbclear
    • dbstack
    • dbstatus
    • dbtype
    • eval
    • evalc
    • evalin
    • feval
    • findprop
    • func2str
    • functions
    • get.p
    • getcallinfo
    • getmethod
    • inputname
    • inputParser
    • isa
    • ischar
    • isdeployed
    • iskeyword
    • ismethod
    • isobject
    • isstring
    • isUnderlyingType
    • isvalid
    • keyboard
    • loadobj
    • localfunctions
    • matlab.metadata.DynamicProperty.delete
    • memoize
    • metaclass
    • mfilename
    • mislocked
    • mlock
    • munlock
    • namelengthmax
    • narginchk
    • nargoutchk
    • new_object
    • notify
    • numArgumentsFromSubscript
    • onCleanup
    • parse
    • saveobj
    • set.p
    • stats
    • str2func
    • subsasgn
    • subsref
    • superclasses
    • underlyingType
    • verLessThan
    • version
    • which
    • who
    • whos

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

assignin(workspace, name, value) transfers the already evaluated value to a whole variable in the selected base or caller workspace, creating that binding when necessary. It has no public output and performs no numeric conversion.

Syntax

assignin(workspace, name, value)

Inputs

workspace
Type
StringScalar
Required
Yes
Description
`base` or `caller` workspace selector.
name
Type
StringScalar
Required
Yes
Description
Workspace variable name.
value
Type
Any
Required
Yes
Description
Value to assign into the selected workspace.
NameTypeRequiredDefaultDescription
workspaceStringScalarYes—`base` or `caller` workspace selector.
nameStringScalarYes—Workspace variable name.
valueAnyYes—Value to assign into the selected workspace.

Errors

RunMat:DynamicWorkspaceRequiresVm
When
A dynamic workspace builtin is dispatched without an active workspace execution context.
Message
dynamic workspace builtin requires an active workspace execution context
RunMat:assignin:TooManyOutputs
When
One or more outputs are requested from assignin.
Message
assignin: too many output arguments
RunMat:DynamicWorkspaceName
When
The variable-name argument is not a valid MATLAB variable name.
Message
assignin: invalid workspace variable name
IdentifierWhenMessage
RunMat:DynamicWorkspaceRequiresVmA dynamic workspace builtin is dispatched without an active workspace execution context.dynamic workspace builtin requires an active workspace execution 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

Arguments and effects

The workspace selector is a character row or scalar string naming base or caller. At the command prompt they address the same workspace; inside a function, caller addresses the calling function's workspace.

The name is one valid variable identifier, not an indexed expression: it begins with an English letter, continues with English letters, digits, or underscores, is not a language keyword, and does not exceed namelengthmax characters.

The value expression is evaluated in the scope containing the assignin call before the resulting scalar or array value is transferred to the selected workspace. A request for any public output raises RunMat:assignin:TooManyOutputs.

Integer values retain exact class, shape, and authoritative storage; wide uint64 values are not routed through double.

GPU execution

Assignment is structural. A resident value retains its provider-owned representation; assignin itself launches no numeric kernel and does not gather or re-upload that payload.

Examples

Export an exact integer array to the base workspace

base = uint64(9007199254740992); assignin('base', 'counts', base + uint64([1 2])); selected = evalin('base', 'counts');

Expected output:

selected retains uint64 values above flintmax

Assign in the calling workspace

outer_x = 5; result = helper();
function out = helper()
    out = evalin('caller', 'outer_x + 2');
    assignin('caller', 'caller_z', 11);
end

Expected output:

result = 7; caller_z = 11

Evaluate an expression before assigning its result

publish_result([1 2 3]); selected = evalin('base', 'published_result');
function publish_result(A)
    result = sum(A);
    assignin('base', 'published_result', result);
end

Expected output:

selected = 6

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 the value in the destination workspace?⌄

No. Its value expression is evaluated in the calling scope, then the resulting value is transferred.

Can the name contain indexing such as A(3)?⌄

No. assignin writes a whole workspace variable; evalin can evaluate destination-workspace indexed source when necessary.

Are integer arrays converted to double?⌄

No. Exact integer class, shape, and payload are preserved, including uint64 values beyond flintmax.

Does a resident GPU value move to the CPU?⌄

No. The selected workspace retains the provider-owned value without a gather performed by assignin.

What value does assignin return?⌄

It has no public output; requesting one is an error.

Related Introspection functions

addlistener · addParameter · addprop · builtin · cancel · class · clear · clearAllMemoizedCaches · clearCache · clearvars · dbclear · dbstack · dbstatus · dbtype · eval · evalc · evalin · feval · findprop · func2str · functions · get.p · getcallinfo · getmethod · inputname · inputParser · isa · ischar · isdeployed · iskeyword · ismethod · isobject · isstring · isUnderlyingType · isvalid · keyboard · loadobj · localfunctions · matlab.metadata.DynamicProperty.delete · memoize · metaclass · mfilename · mislocked · mlock · munlock · namelengthmax · narginchk · nargoutchk · new_object · notify · numArgumentsFromSubscript · onCleanup · parse · saveobj · set.p · stats · str2func · subsasgn · subsref · superclasses · underlyingType · verLessThan · version · which · who · whos

Source you can read

Every RunMat function's source is public. 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 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
  • Arguments and effects
  • GPU execution
  • Examples
  • Export an exact integer array to the base workspace
  • Assign in the calling workspace
  • Evaluate an expression before assigning its result
  • Using assignin with coding agents
  • FAQ
  • Related Introspection functions
  • Source you can read
  • About RunMat