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
    • addpath
    • cd
    • copyfile
    • delete
    • dir
    • exist
    • fileattrib
    • fileparts
    • fullfile
    • genpath
    • getenv
    • getpref
    • isenv
    • isfile
    • isfolder
    • ispref
    • ls
    • matlabroot
    • memmapfile
    • mkdir
    • movefile
    • open
    • opentoline
    • path
    • pathsep
    • pcode
    • pwd
    • readstruct
    • rehash
    • restoredefaultpath
    • rmdir
    • rmpath
    • run
    • savepath
    • setenv
    • setpref
    • system
    • tempdir
    • tempname
    • uigetdir
    • uigetfile
    • uiputfile
    • unsetenv
    • userpath
    • what
    • winqueryreg
    • xmlread
    • xmlwrite

path — Query or replace the active MATLAB search path string.

path reads or updates the path string used for function/script resolution, preserving MATLAB-compatible path-separator and replacement semantics.

Syntax

oldpath = path()
oldpath = path(path1)
oldpath = path(path1, path2)

Inputs

NameTypeRequiredDefaultDescription
path1StringScalarYes—Replacement path string.
path1StringScalarYes—Left path fragment.
path2StringScalarYes—Right path fragment.

Returns

NameTypeDescription
oldpathStringScalarPrevious search path string.

Errors

IdentifierWhenMessage
—Path arguments are not character vectors or string scalars.path: arguments must be character vectors or string scalars
—More than two positional arguments are provided.path: too many input arguments

How path works

  • path() (no inputs) returns the current search path as a character row vector. Each directory is separated by pathsep (; on Windows, : on Linux/macOS). The current working folder (pwd) is implicit and therefore is not included in the string.
  • old = path(newPath) replaces the stored path with newPath and returns the previous value so it can be restored later. newPath may be a character row vector, a string scalar, or a 1-by-N double array of character codes. Whitespace at the ends of entries is preserved, matching MATLAB.
  • old = path(path1, path2) sets the path to path1 followed by path2. When both inputs are non-empty they are joined with pathsep; empty inputs are ignored so path("", path2) simply applies path2.
  • All inputs must be character vectors or string scalars. Single-element string arrays are accepted. Multirow char arrays, multi-element string arrays, numeric arrays that cannot be interpreted as character codes, and other value types raise path: arguments must be character vectors or string scalars.
  • Calling path("") clears the stored path while leaving pwd as the highest-priority location, just like MATLAB. The new value is stored in-process and mirrored to the RUNMAT_PATH environment variable, so exist, which, dir, and other filesystem-aware builtins observe the change immediately.

Does RunMat run path on the GPU?

path operates entirely on host-side state. If an argument lives on the GPU, RunMat gathers it back to the CPU before validation. No acceleration provider hooks are required and no GPU kernels are launched.

GPU memory and residency

No. The MATLAB path is a host-only configuration. RunMat automatically gathers any gpuArray text inputs, applies the request on the CPU, and returns the result as a character array. Explicitly creating gpuArray strings provides no benefit.

Examples

Display the current MATLAB search path

p = path();
disp(p)

Expected output:

//runmat/toolbox://runmat/user

Temporarily replace the MATLAB path

old = path("//runmat-addons");
% ... run code that relies on the temporary path ...
path(old);   % Restore the previous path

Expected output:

old =
    '//runmat/toolbox://runmat/user'

Append folders to the end of the search path

extra = "//projects/analysis";
path(path(), extra);
path()

Expected output:

ans =
    '//runmat/toolbox://runmat/user://projects/analysis'

Prepend folders ahead of the existing path

extra = "/opt/runmat/toolbox";
path(extra, path());
path()

Expected output:

ans =
    '/opt/runmat/toolbox://runmat/toolbox://runmat/user'

Combine generated folder lists

tooling = genpath("submodules/tooling");
old = path(tooling, path())

Expected output:

% The directories returned by genpath now appear ahead of the previous path entries.

Using path with coding agents

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

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

FAQ

Does path include the current folder?⌄

MATLAB automatically searches the current folder (pwd) before consulting the stored path. RunMat follows this rule; the character vector returned by path reflects the explicit path entries, while pwd remains an implicit priority.

Can I clear the path completely?⌄

Yes. Call path("") to remove all explicit entries. The current folder is still searched first.

How do I append to the path without losing the existing value?⌄

Use path(path(), newEntry) to append or path(newEntry, path()) to prepend. Both return the previous value so you can restore it later.

Where is the path stored?⌄

RunMat keeps the value in memory and updates the RUNMAT_PATH environment variable. External tooling that reads RUNMAT_PATH will therefore observe the latest configuration.

Do other builtins see the new path immediately?⌄

Yes. exist, which, run, and other filesystem-aware builtins query the shared path state on each call.

Related Io functions

Repl Fs

addpath · cd · copyfile · delete · dir · exist · fileattrib · fileparts · fullfile · genpath · getenv · getpref · isenv · isfile · isfolder · ispref · ls · matlabroot · memmapfile · mkdir · movefile · open · opentoline · pathsep · pcode · pwd · readstruct · rehash · restoredefaultpath · rmdir · rmpath · run · savepath · setenv · setpref · system · tempdir · tempname · uigetdir · uigetfile · uiputfile · unsetenv · userpath · what · winqueryreg · xmlread · xmlwrite

Net

accept · read · readline · tcpclient · tcpserver · write

Tabular

arrayDatastore · csvread · csvwrite · detectImportOptions · dlmread · dlmwrite · fileDatastore · parquetDatastore · parquetinfo · parquetread · readcell · readmatrix · readtable · readtimetable · spreadsheetImportOptions · writecell · writematrix · writetable · writetimetable · xlsread · xlswrite

Audio

audioinfo · audioread

Io

clc · diary · disp · display · format · input

Filetext

fclose · feof · fgetl · fgets · fileread · filewrite · fopen · fprintf · fread · frewind · fwrite · readlines · writelines

Archive

gunzip · gzip · unzip

Hdf5

h5disp · h5info · h5read · h5write · h5writeatt · hdf5info · hdf5read · hdf5write

Import

importdata · textscan

Json

jsondecode · jsonencode

Mat

load · matfile · save

Http

sendmail · urldecode · urlencode · weboptions · webread · websave · webwrite

Open-source implementation

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

  • View the source for path 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 path works
  • Does RunMat run path on the GPU?
  • GPU memory and residency
  • Examples
  • Display the current MATLAB search path
  • Temporarily replace the MATLAB path
  • Append folders to the end of the search path
  • Prepend folders ahead of the existing path
  • Combine generated folder lists
  • Using path with coding agents
  • FAQ
  • Related Io functions
  • Repl Fs
  • Net
  • Tabular
  • Audio
  • Io
  • Filetext
  • Archive
  • Hdf5
  • Import
  • Json
  • Mat
  • Http
  • Open-source implementation
  • About RunMat