home *** CD-ROM | disk | FTP | other *** search
- function p = path(a,b)
- %PATH Control MATLAB's directory search path.
- % PATH, by itself, prettyprints MATLAB's current search path.
- % The search path list originates as the environment variable
- % MATLABPATH in the underlying operating system, or is set by
- % MATLABRC, and is perhaps individualized by STARTUP.
- %
- % P = PATH returns a string containing the path in P.
- % PATH(P) changes the path to P.
- % PATH(P1,P2) changes the path to the concatenation of the
- % two path strings P1 and P2. Thus PATH(PATH,P) appends
- % a new directory to the current path and PATH(P,PATH)
- % prepends a new path.
- %
- % For example, the following statements add another directory
- % to MATLAB's search path on various operating systems:
- %
- % Unix: path(P,'/home/myfriend/goodstuff')
- % VMS: path(P,'DISKS1:[MYFRIEND.GOODSTUFF]')
- % DOS: path(P,'TOOLS\GOODSTUFF')
- % Mac: path(P,'Tools:GoodStuff')
- %
- % See also GETENV, WHAT, CD, DIR.
-
- % Copyright (c) 1984-93 by The MathWorks, Inc.
-
- if nargin == 0 % pretty-print
- if nargout == 0
- matlabpath
- else
- p = matlabpath;
- end
- elseif nargin == 1
- if ~isstr(a)
- error('Arguments must be strings.')
- end
- matlabpath(a);
- elseif nargin == 2
- if ~isstr(a) | ~isstr(b)
- error('Arguments must be strings.')
- end
- pathsep = ':';
- c = computer;
- if strcmp(c(1:2),'PC') | strcmp(c(1:2),'MA')
- pathsep = ';';
- elseif strcmp(c(1:2),'VA')
- if strcmp(c(1:6),'VAXVMS')
- pathsep = ',';
- end
- end
- matlabpath([a pathsep b]);
- end
-