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

feval — Invoke a function selected by name, handle, closure, or supported receiver.

feval dynamically resolves a callable and forwards arguments and requested outputs without imposing its own numeric or provider semantics.

Syntax

[varargout] = feval(f, varargin)

Inputs

f
Type
Any
Required
Yes
Description
Function handle, handle text, closure, or object receiver.
varargin
Type
Any
Required
Variadic
Description
Function call arguments.
NameTypeRequiredDefaultDescription
fAnyYes—Function handle, handle text, closure, or object receiver.
vararginAnyVariadic—Function call arguments.

Returns

varargout
Type
Any
Description
Function return value(s).
NameTypeDescription
varargoutAnyFunction return value(s).

Returned values from feval depend on how many outputs the caller requests.

Errors

RunMat:FevalHandleNameInvalid
When
A function or method handle name is empty.
Message
feval: function handle name must not be empty
RunMat:FevalHandleShapeInvalid
When
Text handle input has invalid char/string array shape.
Message
feval: function handle text input must be scalar row text
RunMat:SemanticFunctionUnavailable
When
Semantic function identity cannot be invoked in current runtime state.
Message
feval: semantic function handle is unavailable
RunMat:FevalFunctionValueUnsupported
When
The first argument is not a supported callable value.
Message
feval: unsupported function value
IdentifierWhenMessage
RunMat:FevalHandleNameInvalidA function or method handle name is empty.feval: function handle name must not be empty
RunMat:FevalHandleShapeInvalidText handle input has invalid char/string array shape.feval: function handle text input must be scalar row text
RunMat:SemanticFunctionUnavailableSemantic function identity cannot be invoked in current runtime state.feval: semantic function handle is unavailable
RunMat:FevalFunctionValueUnsupportedThe first argument is not a supported callable value.feval: unsupported function value

Behavior

feval(fun, x1, ..., xN) invokes a callable selected at runtime. Plain character-vector or string-scalar names use the same resolution path as direct named calls. Function handles use their bound identity, and closures retain captured values.

Arguments are forwarded without numeric conversion. Output count, class, shape, errors, overflow behavior, side effects, and residency belong to the selected callable and the number of outputs requested at the call site.

RunMat mode additionally accepts text targets prefixed with @ and supported callable object receivers. A MATLAB compatibility pin rejects those extensions before dispatch; ordinary names and actual function handles remain compatible.

GPU execution

feval performs no provider operation of its own. The selected callable determines whether resident inputs remain on their owner, launch a kernel, use a typed fallback, gather, or are rejected.

Examples

Call a function by its plain name

y = feval("round", pi, 2)

Expected output:

y = 3.14

Call a bound function handle

f = @max;
y = feval(f, int32([2 7 4]))

Expected output:

y = int32(7)

Forward the requested output count

[value, index] = feval(@max, uint64([4 9 2]))

Expected output:

value = uint64(9); index = 2

Invoke a closure with captured values

offset = 3;
f = @(x) x.^2 + offset;
y = feval(f, [1 2 3])

Expected output:

y = [4 7 12]

Dispatch to a provider-capable function

G = gpuArray([0 pi/2 pi]);
H = feval(@sin, G);
host = gather(H)

Expected output:

host = [0 1 0] within floating tolerance

Use an @-prefixed text target in RunMat mode

y = feval("@sin", pi / 2)

Expected output:

y = 1

Using feval with coding agents

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

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

FAQ

Does feval convert integer arguments to double?⌄

No. It forwards each value unchanged; conversion and output-class rules belong to the selected callable.

Does feval gather a gpuArray?⌄

Not by itself. The selected callable's provider contract controls residency and fallback.

Can I pass a plain function name?⌄

Yes. Character-vector and scalar-string names are compatible callable selectors.

Is an actual function handle compatible?⌄

Yes. Values such as @sin invoke their bound callable identity.

Is an @-prefixed string portable?⌄

No. Text such as "@sin" is a RunMat extension; use "sin" or @sin for compatible source.

Why can output facts be dynamic?⌄

The target and requested output count can be known only at runtime. When the target is statically known, the compiler can reuse its catalog contract.

Related Introspection functions

addlistener · addParameter · addprop · assignin · builtin · cancel · class · clear · clearAllMemoizedCaches · clearCache · clearvars · dbclear · dbstack · dbstatus · dbtype · eval · evalc · evalin · 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 feval is executed, line by line, in Rust.

  • View the source for feval 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
  • Returns
  • Errors
  • Behavior
  • GPU execution
  • Examples
  • Call a function by its plain name
  • Call a bound function handle
  • Forward the requested output count
  • Invoke a closure with captured values
  • Dispatch to a provider-capable function
  • Use an @-prefixed text target in RunMat mode
  • Using feval with coding agents
  • FAQ
  • Related Introspection functions
  • Source you can read
  • About RunMat