How to Temporarily Change the Current Folder in MATLAB

By Jim Sizemore, John Paul Mueller

When you first start MATLAB, the current folder always defaults to the MATLAB folder found in your user folder for the platform of your choice. For Windows users, that means the C:Users<User Name>DocumentsMATLAB folder. Burying your data way down deep in the operating system may seem like a good idea to the operating system vendor, but you can change the current folder location to something more convenient when desired.

Perhaps your data is actually stored on a network drive, you want to use a shared location so that others can see your data, or you simply want to use a more convenient location on your local drive. The following steps help you change the current folder:

1Click Set Path in the Environment group on the Toolstrip’s Home tab.

You see the Set Path dialog box.

This dialog box lists all the places the MATLAB searches for data, with the default location listed first. You can use these techniques to work with existing folders (go to Step 3 when you’re finished):

To set an existing folder as the default folder, highlight the folder in the list and click Move to Top.

To stop using an existing folder, highlight the folder in the list and click Remove.

2Click Add Folder.

You see the Add Folder to Path dialog box.

This dialog box lets you choose an existing folder that doesn’t appear in the current list or add a new folder to use:

To use a folder that exists on your hard drive, use the dialog box’s tree structure to navigate to the folder, highlight its entry, and then click Select Folder.

To create a new folder, highlight the parent folder in the dialog box’s tree structure, click New Folder, type the name of the folder, press Enter, and then click Select Folder.

3Click Save.

MATLAB makes the folder you select the new default folder. (You may see a User Account Control dialog box when working with Windows; click Yes to allow Windows to perform the task.)

4Click Close.

The Set Path dialog box closes.

5Type the new location in the Address field.

The Current Folder display changes to show the new location.