matlabpath

Gets or sets the folders that make up the search path.

Category: Other public functions: general

Syntax

p = matlabpath

Returns the search path as one character vector, folders separated by pathsep.

matlabpath(newpath)

Replaces the search path with newpath.

Description

The path is the ordered list of folders where a name typed by the user is searched for as a function or script. matlabpath is the low-level accessor that path wraps. Prefer addpath and rmpath to change it, because assigning a whole new path can hide the built-in functions.

Input arguments

newpath
Folders separated by pathsep.

Output arguments

p
Row character vector with the current path.

Example

Inspect the path

p = matlabpath;
disp(ischar(p))
disp(isrow(p))
Output
   1
   1

See also

path addpath rmpath pathsep which