FUNCTION REFERENCE

savepath

Save the current ordered user search path.

Save the current ordered user search path.

Syntax

savepath

Syntax

savepath(file)

Syntax

status = savepath(...)

Writes a MATLAB-readable function p = pathdef with one quoted folder per line, joined by pathsep. Quotes in folder names are escaped. The default file is fullfile(prefdir,'pathdef.m'); an explicit filename resolves against pwd. Status is 0 on success and 1 on failure; failure warns when no output is requested. restoredefaultpath leaves the saved file alone. CLI and desktop load it once at startup, skipping missing folders with a warning.

Example

f=tempname(tempdir); status=savepath(f); delete(f); status   % 0

Differences from MATLAB: The default destination is always prefdir/pathdef.m. At startup pathdef is parsed as data in exactly the format written by savepath; it is never run. Invalid files warn and contribute no folders. Files are limited to 8 MiB and 10000 folders. In the browser savepath warns that files are unavailable and returns 1.

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