Skip to Main Content Skip to Search
Product Documentation

Startup Folder for the MATLAB Program

What Is the Startup Folder?

The startup folder is the current folder in the MATLAB application when it starts. It is convenient if you make the current folder upon startup be a folder that you frequently use. On Windows and Apple Macintosh platforms, a folder called userpath is added automatically to the search path upon startup, and is the default startup folder. On Linux platforms, you can set the userpath as the startup folder. The default value for userpath is, for example, Documents/MATLAB on Microsoft Windows Vista™ platforms. You can specify a different default value for userpath, or specify a different startup folder.

Accepting the default value for userpath and using it as the startup folder offers these benefits:

To view the userpath value, run the userpath function. To specify a location other than the default for userpath, or if you do not want to take advantage of userpath, make changes with the userpath function.

There are other ways to change the startup folder as well as the folders on your search path. For more information, see and Viewing Files and Folders on the Search Path.

Startup Folder on Windows Platforms

The startup folder on Windows platforms depends on any startup options you specified and the way you started MATLAB:

How StartedStartup Folder
Double-click the MATLAB shortcut on yourWindows desktopThe startup folder is set to the userpath value, whose default value is My Documents\MATLAB, or Documents\MATLAB on Windows Vista platforms. The userpath folder 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 folder, 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 folder is the Windows desktop.
Double-click a file type associated with MATLABThe folder in which the file resides is the startup folder. The userpath folder is automatically added to the search path.
In a DOS windowThe folder in which you ran the matlab command is the startup folder. The userpath folder is automatically added to the search path.

Startup Folder on Linux Platforms

On Linux platforms, the default startup folder is the folder from which you started MATLAB.

You can specify that the userpath be the startup folder by setting the value of the environment variable MATLAB_USE_USERPATH to 1 prior to startup. By default, userpath is userhome/Documents/MATLAB, and MATLAB automatically adds the userpath folder to the top of the search path upon startup. To specify a different folder for userpath, and for other options, use the MATLAB userpath function.

Startup Folder on Macintosh Platforms

When you start MATLAB on Apple Macintosh platforms by double-clicking the MATLAB application, the startup folder is the value returned when you enter userpath, which by default is userhome/Documents/MATLAB. MATLAB automatically adds the userpath folder to the top of its search path upon startup. To specify a different folder for userpath, and for other options, use the userpath function.

When you start MATLAB in a shell, the default startup folder is the folder from which you started MATLAB.

Changing the Startup Folder

You can start MATLAB in a folder other than the default in one of these ways:

Changing the Startup Folder Via the userpath Function

Use the userpath function to change the startup folder as well as to add the startup folder to the search path upon startup. For more information, see the userpath reference page and .

Changing the Startup Folder Using the Shortcut — Windows Platforms Only

To change the startup folder on Windows platforms using the shortcut,

  1. 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.

  2. The Target field contains the full path to start MATLAB.

    By default, the startup folder is My Documents\MATLAB or Documents\MATLAB on Windows Vista platforms; for more information, see Startup Folder on Windows Platforms.

    In the Start in field, specify the full path to the folder in which you want MATLAB to start, and click OK.

    Image of Properties dialog box showing how to change the startup folder.

The next time you start MATLAB using that shortcut icon, the current folder will be the one you specified in step 2.

You can make multiple shortcuts to start MATLAB, each with its own startup folder, and with each startup folder having different startup options.

Changing the Startup Folder Using the startup.m File

Use the startup.m file to specify the startup folder as well as other startup options—for details, see Specifying Startup Options in the MATLAB Startup File.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS