Desktop Tools and Development Environment Previous page   Next Page

Viewing the Search Path

The MATLAB search path field in the Set Path dialog box lists all of the directories on the search path. The top of the list is the start of the search path, while the bottom of the list is the end.

Function Alternative.   Use the path function to view the search path.

Adding Directories to the Search Path

Add directories to the search path when you want to run M-files in those directories.

To add directories to the MATLAB search path using the Set Path dialog box,

  1. Click the Add Folder or the Add with Subfolders button.
  1. The Browse for Folder dialog box opens.

  1. In the Browse for Folder dialog box, use the view of your file system to select the directory to add, and then click OK.
  1. The selected directory, and subdirectories if specified in step 1, are added to the top of the search path.

  1. To use the newly modified search path in future sessions, click Save. For more information about saving the path, see Saving Settings to the Path.
  2. Click Close. If you did not save the changes in the previous step, the directories you added remain on the search path until you end the current MATLAB session.

You cannot add method directories (directories that start with @) and private directories to the MATLAB search path.

Adding Directories to the Path from the Current Directory Browser.   In the Current Directory browser, select a directory, right-click, and select Add to Path from the context menu. Then select one of the submenus, for example, Selected Folder and Subfolders.

Function Alternative.   To add directories to the top or the end of the search path, use addpath. The addpath function offers an option to get the path as a string and to concatenate multiple strings to form a new path.

You can include addpath statements in your startup M-file to automatically modify the path when MATLAB starts. For details, see Modifying the Path in a startup.m File.


Previous page  Viewing and Setting the Search Path Moving Directories Within the Search Path Next page

© 1994-2005 The MathWorks, Inc.