FUNCTION REFERENCE

addpath

Add folders to the user search path.

Add folders to the user search path.

Syntax

addpath(folder1, ..., folderN)

Syntax

addpath(..., '-begin')

Syntax

addpath(..., '-end')

Syntax

oldpath = addpath(...)

Each argument may be a pathsep-separated list such as genpath output. Folders go to the top in the given order (default -begin) or the bottom (-end); a folder already on the path moves. Relative names resolve against pwd. A missing folder warns "Name is nonexistent or not a directory" and is skipped. A .m/.mr file in a path folder shadows a builtin of the same name; the current folder still wins.

Private functions: a .m/.mr file in a subfolder named private is visible only to the files of the folder that contains it, and to the other files of that private folder. There it is found after local functions and before the current folder, the path and builtins; at the Command Window and from other folders it is not found. A handle made inside the folder keeps working elsewhere. Private folders do not go on the path; genpath leaves them out.

Example

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

Differences from MATLAB: -frozen is accepted and ignored. No toolbox folders.

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