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
    • 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

which — Resolve which variable, builtin, file, or class matches a given name.

which name reports what RunMat will resolve for name according to MATLAB-compatible search precedence across variables, builtins, files, and class methods.

Syntax

result = which(name)
result = which(name, option)
result = which(option, name)
results = which("-all", name)

Inputs

NameTypeRequiredDefaultDescription
nameStringScalarYes—Name to resolve.
optionStringScalarNo"-all"Optional mode filter (-all|-builtin|-var|-file).
optionStringScalarYes—Mode filter (-all|-builtin|-var|-file).

Returns

NameTypeDescription
resultStringScalarSingle resolution result string.
resultsAnyAll matching resolution strings (cell array of char rows).

Errors

IdentifierWhenMessage
—No input arguments are provided.which: not enough input arguments
—More than one name argument is provided.which: too many input arguments
—Name argument is not a char row or string scalar.which: name must be a character vector or string scalar
—Option argument is not a char row or string scalar.which: option must be a character vector or string scalar
—Conflicting mode options are combined.which: conflicting option
—An unrecognized mode option is provided.which: unrecognized option

How which works

  • Names can be supplied as character vectors or string scalars. Calling which with no name raises which: not enough input arguments.
  • which name without options returns the first match respecting MATLAB's precedence rules.
  • which(name, "-all") (or which("-all", name)) returns a cell array with every match on the search path, in discovery order, without duplicates.
  • which(..., "-builtin") restricts the search to builtin functions. "-var" restricts to workspace variables, and "-file" restricts the search to files, classes, and folders.
  • Package-qualified names like pkg.func automatically map to +pkg folders. Class lookups recognise both @ClassName folders and .m files containing classdef.
  • Relative paths are resolved against the current working directory. Absolute paths and paths beginning with ~ or drive letters are honoured directly.

Does RunMat run which on the GPU?

which performs string parsing and filesystem inspection on the host CPU. If you pass GPU-resident strings (for example, gpuArray("sin")), RunMat gathers them automatically before evaluating the request. Results are always host-resident character arrays or cell arrays. Acceleration providers do not implement kernels for this builtin.

GPU memory and residency

No. which gathers GPU arguments implicitly and never produces device-resident output. There is no benefit in moving strings to the GPU before calling which.

Examples

Finding a built-in function's implementation

which("sin")

Expected output:

built-in (RunMat builtin: sin)

Checking if a workspace variable shadows a builtin

answer = 42;
which("answer")

Expected output:

'answer' is a variable.

Listing all matches on the path

which("sum", "-all")

Expected output:

{
    [1,1] = built-in (RunMat builtin: sum)
    [2,1] = //runmat/stdlib/sum.m
}

Locating a script or function file

which("helpers/process_data")

Expected output:

//projects/runmat/helpers/process_data.m

Restricting the search to variables

which("-var", "velocity")

Expected output:

'velocity' is a variable.

Restricting the search to files

which("fft", "-file")

Expected output:

//runmat/overrides/fft.m

Using which with coding agents

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

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

FAQ

What happens when nothing is found?⌄

which returns the character vector '<name>' not found. just like MATLAB.

Are method lookups supported?⌄

Methods defined via @Class folders or classdef files are discovered through the class search. Package-qualified methods are supported.

Does which canonicalise paths?⌄

Yes. RunMat reports canonical absolute paths where possible; when canonicalisation fails, the original path is returned.

Can I combine -all with other options?⌄

Yes. For example, which("plot", "-all", "-file") lists every file-based implementation without reporting builtins or variables.

Does the search respect RUNMAT_PATH / MATLABPATH?⌄

Yes. The directory list mirrors the logic used by other REPL filesystem builtins.

What about Simulink models or Java classes?⌄

File-based matches with supported extensions (.slx, .mdl, .class, etc.) are reported when present on the path.

Are duplicate results filtered?⌄

Yes. The first occurrence of each unique path is returned.

Is the lookup case sensitive?⌄

No. Matching is case-insensitive on all platforms, following MATLAB semantics.

Does which gather GPU values?⌄

Yes. GPU-resident arguments are automatically gathered before the search begins.

Related Introspection functions

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 · who · whos

Open-source implementation

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

  • View the source for which 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 which works
  • Does RunMat run which on the GPU?
  • GPU memory and residency
  • Examples
  • Finding a built-in function's implementation
  • Checking if a workspace variable shadows a builtin
  • Listing all matches on the path
  • Locating a script or function file
  • Restricting the search to variables
  • Restricting the search to files
  • Using which with coding agents
  • FAQ
  • Related Introspection functions
  • Open-source implementation
  • About RunMat