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

feval — Evaluate a function selected by name or function handle.

feval(fun, x1, ..., xM) evaluates the function selected by the name or function handle fun and forwards the requested number of outputs. Argument and result classes, shapes, overflow behavior, and provider residency are defined by the selected function rather than by feval.

Syntax

[varargout] = feval(f, varargin)

Inputs

NameTypeRequiredDefaultDescription
fAnyYes—Function handle, handle text, closure, or object receiver.
vararginAnyVariadic—Function call arguments.

Returns

NameTypeDescription
varargoutAnyFunction return value(s).

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

Errors

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

How feval works

  • A plain character-vector or string-scalar function name such as 'round' or "round" is resolved using the same callable dispatch rules as a direct named call.
  • A function handle invokes its bound function identity. Closures preserve their captured values and semantic function identity.
  • Input arguments are forwarded without numeric conversion. This includes all eight integer classes, logical values, native single values, complex values, and provider-resident arrays when the selected function supports them.
  • The number and classes of outputs are inherited from the selected function and the number of outputs requested by the caller.
  • RunMat mode additionally accepts text targets prefixed with @, such as "@sin", and callable object receivers. Strict compatibility mode rejects those extensions before dispatch.

Does RunMat run feval on the GPU?

feval does not launch a kernel, gather an input, or upload an output on its own. It passes the original values to the selected callable, whose registered provider contract controls all GPU behavior.

Examples

Evaluate a function by its documented plain name

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

Expected output:

y = 3.1400

Evaluate a function handle

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

Expected output:

y = int32(7)

Forward multiple outputs

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

Expected output:

% value and index follow max's documented output rules

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. feval forwards each value unchanged. Any conversion, overflow rule, or output-class choice belongs to the selected function.

Does feval gather a GPU array?⌄

Not by itself. The selected function determines whether a resident input stays on its provider, launches a kernel, falls back through the host, or is rejected.

Can I pass the function name without an @ prefix?⌄

Yes. A plain function name is the documented text form. An @-prefixed text value is a separate RunMat-mode convenience; an actual function handle such as @sin is supported in compatibility mode.

Why can the output type vary?⌄

feval is dynamic dispatch. Its output count, class, shape, and residency are exactly those produced by the selected function for the supplied arguments.

Related Introspection functions

addprop · assignin · class · clear · clearAllMemoizedCaches · clearCache · clearvars · dbclear · dbstack · dbstatus · dbtype · evalc · 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 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 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 feval works
  • Does RunMat run feval on the GPU?
  • Examples
  • Evaluate a function by its documented plain name
  • Evaluate a function handle
  • Forward multiple outputs
  • Using feval with coding agents
  • FAQ
  • Related Introspection functions
  • Open-source implementation
  • About RunMat