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

rmpath — Remove folders from the active MATLAB search path with MATLAB-compatible argument handling.

rmpath removes one or more folders from the active MATLAB search path used for function and script resolution. Updates apply immediately and follow MATLAB-compatible validation and error reporting for missing, invalid, or non-path folders.

Syntax

oldpath = rmpath(folder1)
oldpath = rmpath(folder1, folder2, ...)

Inputs

NameTypeRequiredDefaultDescription
folder1AnyYes—Folder, path-list string, or container of folders to remove.
folder1AnyYes—First folder argument.
folderNAnyVariadic—Additional folder arguments.

Returns

NameTypeDescription
oldpathStringScalarPrevious search path string.

Errors

IdentifierWhenMessage
—Folder arguments are not character vectors, string scalars/arrays, tensors of character codes, or cell arrays containing those forms.rmpath: folder names must be character vectors, string scalars, string arrays, or cell arrays of character vectors
—No folder arguments are provided, or all provided folder tokens are empty.rmpath: at least one folder must be specified
—Current directory cannot be resolved while normalizing a relative folder.rmpath: unable to resolve current directory
—The requested path exists but is not a folder.rmpath: path is not a folder
—The requested folder exists but is not on the active search path.rmpath: folder not on search path
—The requested folder path does not exist.rmpath: folder not found

How rmpath works

  • Folder arguments may be character vectors, string scalars, string arrays, or cell arrays of character vectors or strings. Multi-row char arrays contribute one folder per row (trailing padding is stripped).
  • Numeric inputs, including every integer class and resident numeric handles, reject before path mutation or provider access rather than being converted to text.
  • Multiple folders can be passed inside a single argument using the platform path separator (: on Linux/macOS, ; on Windows); this is compatible with genpath output.
  • RunMat accepts any ordering of arguments. Each requested folder is removed at most once even if it appears repeatedly.
  • Inputs are resolved to absolute, normalised paths. Relative inputs are interpreted relative to the current working directory, and ~ expands to the user’s home directory.
  • Folders must exist and must currently be present on the MATLAB path. RunMat raises rmpath: folder '<name>' not found when a directory cannot be located, or rmpath: folder '<name>' not on search path when the directory exists locally but is absent from the current search path.
  • rmpath returns the previous path so callers can restore it later via path(old), matching RunMat’s addpath and path builtins.

Does RunMat run rmpath on the GPU?

rmpath manipulates host-side configuration. Numeric provider handles are rejected before gathering because they cannot represent path text; no acceleration provider hooks or kernels are involved.

GPU memory and residency

No. rmpath operates entirely on CPU-side strings and does not treat resident numeric storage as text.

Examples

Removing a single folder from the MATLAB search path

old = rmpath("util/toolbox");
disp(old);
path()

Expected output:

old =
    '/Users/you/runmat/toolbox:util/toolbox'
% The folder util/toolbox no longer appears in the active search path.

Removing multiple folders at once

rmpath("shared/filters", "shared/signal");
path()

Expected output:

% shared/filters and shared/signal are both removed from the MATLAB path.

Removing folders produced by genpath

tree = genpath("third_party/toolchain");
rmpath(tree)

Expected output:

% Every directory returned by genpath is pruned from the search path.

Removing folders specified in a cell array

folders = {'src/algorithms', 'src/visualization'};
rmpath(folders{:});
path()

Expected output:

% Both folders are removed from the MATLAB search path.

Capturing and restoring the previous path after removal

old = rmpath("analysis/utilities");
% ... run experiments ...
path(old);   % Restore the previous path
path()

Expected output:

% The original search path is restored when you call path(old).

Handling attempts to remove folders that are not on the path

rmpath("nonexistent/toolbox")

Using rmpath with coding agents

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

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

FAQ

Does rmpath insist on absolute paths?⌄

No. Relative inputs are resolved against the current working directory and stored as absolute paths before matching against the path.

What happens with duplicate folders in the argument list?⌄

Each folder is processed once per call. Duplicate input values are ignored after the first removal.

How do I confirm removal succeeded?⌄

Call path() or which to confirm that the folder (or files within it) no longer appear on the MATLAB search path.

Does rmpath update the RUNMAT_PATH environment variable?⌄

Yes. Changes are reflected immediately so other RunMat tooling observes the new path.

Can I remove folders that were added via path(newPath)?⌄

Yes. rmpath matches entries exactly as they appear in the stored search path string, regardless of how they were inserted.

Will rmpath accept GPU strings?⌄

Yes. Inputs are gathered automatically, then processed on the CPU.

What happens if the folder exists locally but is not on the search path?⌄

RunMat raises rmpath: folder '<name>' not on search path, matching MATLAB’s expectation that only active path entries are removed.

Does rmpath return the new or previous path?⌄

It returns the previous path so you can restore it later with path(old).

Is there a bulk reset option?⌄

To clear the path entirely call path(""). rmpath intentionally targets specific folders.

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 · path · pathsep · pcode · pwd · readstruct · rehash · restoredefaultpath · rmdir · 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 rmpath is executed, line by line, in Rust.

  • View the source for rmpath 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 rmpath works
  • Does RunMat run rmpath on the GPU?
  • GPU memory and residency
  • Examples
  • Removing a single folder from the MATLAB search path
  • Removing multiple folders at once
  • Removing folders produced by genpath
  • Removing folders specified in a cell array
  • Capturing and restoring the previous path after removal
  • Handling attempts to remove folders that are not on the path
  • Using rmpath 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