View or change default user work folder
userpath
returns a user-specific folder that MATLAB® adds to the search path at startup, specified as a character
vector.
userpath(
sets the
user-specific folder on the search path to newpath
)newpath
. The
folder specified using userpath
appears on the search path
immediately, and at startup in future sessions. MATLAB removes the folder previously specified by
userpath
from the search path.
userpath('reset')
sets the user-specific folder on the
search path to the default for your platform. The default
userpath
folder is platform-specific.
Windows® platforms —
%USERPROFILE%/Documents/MATLAB
.
Mac platforms —
$home/Documents/MATLAB
.
Linux® platforms —
$home/Documents/MATLAB
if
$home/Documents
exists.
MATLAB immediately adds the default folder to the search path, and also adds it to the search path at startup in future sessions. On Windows and Mac platforms, the default folder is created if it does not exist. On Linux, the default folder is not created if it does not exist.
userpath('clear')
removes the user-specific folder from
the search path immediately, and for future MATLAB sessions.
In MATLAB
Online™, you only can view the folder specified by
userpath
. Changing the folder is not supported.
To specify the startup folder, set the Initial working folder preference, described in General Preferences.
The MATLABPATH
environment variable can contain a list of
folders to be added to the search path. MATLAB adds the folders specified in the MATLABPATH
environment variable to the search path below the
userpath
folder at startup.