FUNCTION REFERENCE

path

View or change the user search path.

View or change the user search path.

Syntax

p = path

Syntax

path

Syntax

oldpath = path(newpath)

Syntax

oldpath = path(path1, path2)

Returns the user folders joined by pathsep ('' when none); with no output, prints one folder per line. path(newpath) replaces the folders; path(path1,path2) sets path1 followed by path2. Arguments are pathsep-separated folder lists; empty entries are dropped and a missing folder warns and is skipped. Function lookup searches the current folder first, then these folders in order, then builtins.

Example

old=path; path(tempdir); n=numel(strsplit(path,pathsep)); path(old); n   % 1

Differences from MATLAB: The path holds only user folders, no toolbox folders. Folders are stored as absolute canonical paths.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.