path - View or change search path

GUI Alternatives

As an alternative to the path function, use the Set Path dialog box.

Syntax

path
path('newpath')
path(path,'newpath')
path('newpath',path)
p = path(...)

Description

path displays the current MATLAB search path. The search path is stored in the file pathdef.m.

path('newpath') changes the search path to newpath, where newpath is a string array of directories.

path(path,'newpath') adds the newpath directory to the bottom of the current search path. If newpath is already on the path, then path(path, 'newpath') moves newpath to the end of the path.

path('newpath',path) adds the newpath directory to the top of the current search path. If newpath is already on the path, then path('newpath', path) moves newpath to the beginning of the path.

p = path(...) returns the specified path in string variable p.

Examples

To display the search path, run

path

MATLAB displays, for example

MATLABPATH

	H:\My Documents\MATLAB
	C:\Program Files\MATLAB\R2008b\toolbox\matlab\general
	C:\Program Files\MATLAB\R2008b\toolbox\matlab\ops
	C:\Program Files\MATLAB\R2008b\toolbox\matlab\lang
	C:\Program Files\MATLAB\R2008b\toolbox\matlab\elmat
	C:\Program Files\MATLAB\R2008b\toolbox\matlab\elfun
...

Add a new directory to the search path on Microsoft Windows platforms.

path(path,'c:/tools/goodstuff')

Add a new directory to the search path on UNIX[1] platforms.

path(path,'/home/tools/goodstuff')

See Also

addpath, cd, dir, genpath, matlabroot, partialpath, pathsep, pathtool, rehash, restoredefaultpath, rmpath, savepath, startup, userpath, what

Search Path in the MATLAB Desktop Tools and Development Environment documentation, especially Programmatically Working with the Search Path.


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

  


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