Skip to content

savepath

path · scripts/path/savepath.m

: savepath ()
: savepath (file)
: status = savepath (…)

Store the folders of the current search path in a function file for later use.

The file defines one function, named after the file, that returns the folders as a single string with pathsep between them. When file is left out, pathdef.m is written under userpath (Documents/MATLAB), else legacy ~/MATLAB, else the Nexus configuration folder. Existing files are replaced, and the search path of the running session stays as it is.

When called with an output, status is 0 after success and 1 when the file could not be written; without an output, a failure is an error.