Documentation Center

  • Trials
  • Product Updates

Change Folders on the Search Path

For Current and Future Sessions

You can interactively add and remove folders, and change the order of folders on the search path, for the current MATLAB® session and for future MATLAB sessions. When files with the same name appear in multiple folders on the search path, MATLAB uses the one found in the folder nearest to the top of the search path.

  1. On the Home tab, in the Environment section, click Set Path. The Set Path dialog box appears.

  2. Use the Set Path dialog box to modify the search path.

  3. Apply or cancel the search path changes:

    • To use the newly modified search path only in the current session, click Close.

    • To reuse the newly modified search path in the current session and future sessions, click Save, and then Close.

    • To undo your changes, click Revert, and then Close.

    • To restore the default search path, click Default, and then Close. The default search path contains only folders provided by MathWorks®.

    Note:   The MATLAB (userpath) folder automatically moves to the top of the search path the next time you start MATLAB. For more information about the userpath folder, see userpath Folder on the Search Path

For the Current Session Only

There are three ways to change the folders on the search path for the current MATLAB session only:

  • Use the Set Path dialog box to make changes to the search path, and do not save the changes.

    1. On the Home tab, in the Environment section, click Set Path.

    2. After making the changes, click Close.

  • Use the Current Folder browser to add or remove folders from the search path.

    1. From the Current Folder browser, select, and then right-click the folder or folders to add or remove.

    2. From the context menu, select Add to Path or Remove from Path, and then select an option:

      • Selected Folders

      • Selected Folders and Subfolders

  • In the Editor, you also can add or remove the folder that contains an Editor document from the search path. Right-click the document tab, and then select an option to Add or Remove the folder from the Search Path.

See Also

| |

Was this topic helpful?