FUNCTION REFERENCE

userpath

View or change the persistent user work folder.

View or change the persistent user work folder.

Syntax

p = userpath

Syntax

userpath(newpath)

Syntax

userpath('reset')

Syntax

userpath('clear')

The default is ~/Documents/MatRust (USERPROFILE/Documents/MatRust on Windows). A new folder must exist. Changes are saved in prefdir and immediately remove the old folder from the live path and put the new folder at the top when it exists. clear removes the folder; reset selects the default. CLI and desktop startup add this folder before saved path folders. Engine::default() does not load settings.

Example

d=tempname(tempdir); setenv('MATRUST_PREFDIR',d); setenv('HOME',d); setenv('USERPROFILE',d); userpath('clear'); p=userpath; delete(fullfile(d,'userpath.txt')); rmdir(d); isempty(p)   % 1

Differences from MATLAB: The default folder is not created automatically. Folder names containing pathsep or line breaks are unsupported. In the browser userpath returns '' and changes have no effect.

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