| MATLAB® | ![]() |
| On this page… |
|---|
What Is the Startup Directory? Startup Directory (Folder) on Windows® Platforms Startup Directory on UNIX® Platforms |
The startup directory is the current directory in MATLAB® program when it starts. It is convenient if the current directory upon startup is one that you regularly use. By default, it is a Documents/MATLAB subdirectory, or My Documents/MATLAB on Microsoft® Windows® platforms other than Windows Vista™. You can specify a different startup directory. The userpath, a directory that is by default automatically added to the search path upon startup, is the default startup directory on Windows platforms, while on The Open Group UNIX® and Apple® Macintosh® platforms, the userpath can be set as the startup directory.
Accepting the default value for userpath, and using it as the startup directory, offers these features:
You can store the MATLAB files you work with in one, appropriately-named location, Documents/MATLAB (or My Documents/MATLAB).
Your MATLAB files are readily available upon startup, because the current directory is automatically the Documents/MATLAB subdirectory (or My Documents/MATLAB).
You can always run your files because MATLAB automatically adds the Documents/MATLAB subdirectory (or My Documents/MATLAB) to the top of the search path upon startup.
The first time you run a new MATLAB version, MATLAB automatically creates the Documents/MATLAB subdirectory (or My Documents/MATLAB).
This location also utilizes the benefits provided by the standard location in the Windows and Macintosh environments for storing personal files. Files in the Documents/MATLAB subdirectory (or My Documents/MATLAB) are available to you when you use other machines. Because each user has their own Documents/MATLAB subdirectory (or My Documents/MATLAB), other users, even those using your machine, cannot access files in your Documents/MATLAB subdirectory (or My Documents/MATLAB.
When you upgrade to a newer version of MATLAB, MATLAB automatically continues to use the same MATLAB subdirectory and your existing files, with all of the above benefits.
To view the userpath value, specify a location other than the default for userpath, or if you do not want to take advantage of userpath, use the userpath function.
There are other ways to change the startup directory as well as the directories on your search path; for more information, see Changing the Startup Directory and Viewing and Setting the Search Path.
The startup directory (folder) on Windows platforms depends on any startup options you specified and the way you started MATLAB:
Startup Directory When Starting the MATLAB® Program from a Windows® Shortcut
Startup Directory When Starting the MATLAB® Program from an Associated File
Startup Directory When Starting the MATLAB® Program from a DOS Window
When you start the MATLAB program from a MATLAB shortcut in the Windows environment, by default MATLAB sets the startup directory to the userpath value, whose default value is My Documents\MATLAB, or Documents\MATLAB on Windows Vista platforms. The userpath directory is automatically added to the search path.
If there is a value specified in the Start in field of the Properties dialog box for the MATLAB program, that value is the startup directory, although the userpath is added to the search path. If MATLAB does not find a valid userpath value upon startup, and the Start in field is empty, the startup directory is the Windows desktop.
When you start MATLAB by double-clicking a file type associated with MATLAB, that file's directory is the startup directory. The userpath directory is automatically added to the search path.
When you start MATLAB from a DOS window, the startup directory is the directory in which you ran the matlab function. The userpath directory is automatically added to the search path.
On The Open Group UNIX platforms, the default startup directory is the directory from which you started MATLAB. You can specify that the userpath be the startup directory by setting the environment variable MATLAB_USE_USERPATH value to 1 prior to startup. By default, userpath is userhomme/Documents/MATLAB, and MATLAB automatically adds the userpath directory to the top of is search path upon startup. To specify a different directory for userpath, and for other options, use the userpath function.
When you start MATLAB on Apple Macintosh platforms by double-clicking the MATLAB application, the startup directory is the value returned by userpath, which by default is userhome/Documents/MATLAB. MATLAB automatically adds the userpath directory to the top of its search path upon startup. To specify a different directory for userpath and for other options, use the userpath function.
When you start MATLAB using the Start MATLAB Settings dialog box or icons you created from it, the value specified in its Current directory field is the startup directory.
When you start MATLAB in a shell, the startup directory is the same as for other UNIX platforms—see Startup Directory on UNIX® Platforms.
You can start MATLAB in a directory other than the default in one of these ways:
Use the userpath function to change the startup directory as well as to add the startup directory to the search path upon startup. For more information, see the userpath reference page and Startup Directory for the MATLAB® Program.
To change the startup directory on Windows platforms using the shortcut,
Right-click the shortcut icon for MATLAB and select Properties from the context menu.
The Properties dialog box for MATLAB opens to the Shortcut pane.
The Target field contains the full path to start MATLAB.
By default, the startup directory is My Documents\MATLAB or Documents\MATLAB on Windows Vista; for more information, see Startup Directory (Folder) on Windows® Platforms.
In the Start in field, specify the full path to the directory in which you want MATLAB to start, and click OK.

The next time you start MATLAB using that shortcut icon, the current directory will be the one you specified in step 2.
You can make multiple shortcuts to start MATLAB, each with its own startup directory, and with each startup directory having different startup options.
To change the startup directory and specify other startup options on Macintosh platforms, use the Start MATLAB Setting s dialog box—for details, see Specifying Startup Options for Macintosh® Platforms.
Use the startup.m file to specify the startup directory as well as other startup options—for details, see Specifying Startup Options Using the Startup File for the MATLAB® Program, startup.m.
![]() | Starting the MATLAB® Program on Macintosh® Platforms | Startup Options | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |