rmpath

Removes folders from the search path.

Category: Programming > Files and Folders

Syntax

rmpath(folder)

Removes folder from the path.

oldpath = rmpath(folder)

Also returns the path as it was before.

Description

rmpath is the counterpart of addpath. The folder is left on disk; only the lookup stops. To remove a whole tree, pass the result of genpath: rmpath(genpath('lib')).

Input arguments

folder
Folder to remove, as text; it must match the text that was added.

Output arguments

oldpath
The previous path.

Example

Adding and removing a folder

mkdir lib
writelines('function y = triple(x), y = 3*x; end', 'lib/triple.m');
addpath('lib')
exist('triple')
rmpath('lib')
exist('triple')
Output
ans = 2
ans = 0

See also

addpath genpath path restoredefaultpath