Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

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 UNIX[1] 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 Changing the Startup Folder and Ways to View and Change 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:

Startup Folder When Starting the MATLAB Program from a Windows Shortcut

When you start the MATLAB program from a Windows shortcut, by default MATLAB sets the startup folder 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.

Startup Folder When Starting the MATLAB Program from an Associated File

When you start MATLAB by double-clicking a file type associated with MATLAB, that file's folder is the startup folder. The userpath folder is automatically added to the search path.

Startup Folder When Starting the MATLAB Program from a DOS Window

When you start MATLAB from a DOS window, the startup folder is the folder in which you ran the matlab function. The userpath folder is automatically added to the search path.

Startup Folder on UNIX Platforms

On UNIX 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 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 startup folder is the same as for other UNIX platforms—see Startup Folder on UNIX Platforms.

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 Startup Folder for the MATLAB Program.

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 Using the Startup File for the MATLAB Program, startup.m.


[1] UNIX is a registered trademark of The Open Group in the United States and other countries.

  


Recommended Products

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

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