MATLAB Startup Folder - MATLAB & Simulink (original) (raw)

Main Content

Default Startup Folder

By default, MATLAB® sets the startup folder based on the way you start MATLAB. To identify the startup folder, type pwd at the command line immediately after starting MATLAB and before typing any other commands. You can change the startup folder using theGeneral Settings options in the Settings Window. For convenience, make this folder a folder that you frequently use.

Note

If a startup.m file changes the current folder, then this value overrides the initial working folder value. Do not addcd statements to startup.m. For more information about user-defined options, see startup.

Default Folder on Windows Platforms

How You Start MATLAB Startup Folder
Double-click the MATLAB icon on your Windows® desktop or in the Start menu Last working folder from the previous MATLAB session or the custom path specified in the setting. The setting is located in theGeneral Settings page of the Settings window.
From a Windows system prompt Folder in which you run the matlab command (To use the folder specified by the setting, use the -useStartupFolderPref startup option.)
From the MATLAB command prompt Folder in which you run the!matlab command
Double-click a file type associated with MATLAB Folder containing the file
Double-click the matlab.exe executable file from Windows Explorer Tool Last working folder from the previous MATLAB session or the custom path specified in the setting

For more information, see Start MATLAB on Windows Platforms.

If you start MATLAB by double-clicking the MATLAB shortcut icon and the startup folder is set to an unexpected location, follow these steps to ensure that the Start in field in the MATLAB shortcut icon is empty:

  1. Right-click the shortcut icon for MATLAB and select from the context menu. The Properties dialog box for MATLAB opens to the Shortcut pane.
  2. If the Start in field contains text, clear the text.
  3. Click OK and try starting MATLAB again.

Default Folder on macOS Platforms

How You Start MATLAB Startup Folder
Double-click the MATLAB application Last working folder from the previous MATLAB session or the custom path specified in the setting, located in the General Settings page of the Settings window
Start MATLAB from a Terminal window Folder in which you run the matlab command

For more information, see Start MATLAB on macOS Platforms.

Default Folder on Linux Platforms

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

For more information, see Start MATLAB on Linux Platforms.

Change Startup Folder

You can change the startup folder using theGeneral Settings options in the Settings Window. On theHome tab, in the Environment section, click Settings. Select > . Choose an option for the setting.

Alternatively on Windows platforms, specify the initial working folder in the MATLAB shortcut icon. For more information, see Select MATLAB Icon.

userpath as Initial Working Folder

Using userpath as the value offers these benefits.

See Also

startup

Topics