This is a static copy of a profile reportHome
path (1 call, 0.033 sec)
Generated 05-Aug-2011 13:00:29 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/general/path.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
addpath | function | 1 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
110 | matlabpath([cPath1{:} cPath2{:... | 1 | 0.011 s | 33.3% |  |
75 | cPath2 = parsedirs(path2); | 1 | 0.011 s | 33.3% |  |
41 | pp = matlabpath; | 1 | 0.011 s | 33.3% |  |
115 | if nargout==1, p = matlabpath;... | 1 | 0 s | 0% |  |
113 | end | 1 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.033 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
general/private/parsedirs | function | 2 | 0.011 s | 33.3% |  |
Self time (built-ins, overhead, etc.) | | | 0.022 s | 66.7% |  |
Totals | | | 0.033 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 115 |
Non-code lines (comments, blank lines) | 51 |
Code lines (lines that can run) | 64 |
Code lines that did run | 41 |
Code lines that did not run | 23 |
Coverage (did run/can run) | 64.06 % |
Function listing
time calls line
1 function p = path(path1,path2)
2 %PATH Get/set search path.
3 % PATH, by itself, prettyprints MATLAB's current search path. The initial
4 % search path list is set by PATHDEF, and is perhaps individualized by
5 % STARTUP.
6 %
7 % P = PATH returns a string containing the path in P. PATH(P) changes the
8 % path to P. PATH(PATH) refreshes MATLAB's view of the directories on
9 % the path, ensuring that any changes to non-toolbox directories are
10 % visible.
11 %
12 % PATH(P1,P2) changes the path to the concatenation of the two path
13 % strings P1 and P2. Thus PATH(PATH,P) appends a new directory to the
14 % current path and PATH(P,PATH) prepends a new directory. If P is already
15 % on the path, then PATH(PATH,P) moves P to the end of the path,
16 % and similarly, PATH(P,PATH) moves P to the beginning of the path.
17 %
18 % For example, the following statements add another directory to MATLAB's
19 % search path on various operating systems:
20 %
21 % Unix: path(path,'/home/myfriend/goodstuff')
22 % Windows: path(path,'c:\tools\goodstuff')
23 %
24 % See also WHAT, CD, DIR, ADDPATH, RMPATH, GENPATH, PATHTOOL, SAVEPATH, REHASH.
25
26 % Copyright 1984-2006 The MathWorks, Inc.
27 % $Revision: 5.24.4.8 $ $Date: 2006/10/14 12:24:11 $
28
1 29 if nargin == 0 % Pretty-print
30 if nargout == 0
31 matlabpath
32 end
1 33 elseif nargin == 1
34 matlabpath(path1) % matlabpath will check and process path1
1 35 elseif nargin == 2
1 36 if ~ischar(path1) || ~ischar(path2)
37 error('MATLAB:string','Arguments must be strings.')
38 end
39
40 % If path1 is contained in path2 or vice versa, don't add it
0.01 1 41 pp = matlabpath;
42
43 % Windows is case-insensitive
44 % Use "Cased" variables for comparisons,
45 % but do real work on path1 and path2
46 % Define FILESEP and PATHSEP, since these are not built-in
47 % and PATH might be called with an empty MATLAB path
1 48 if strncmp(computer,'PC',2)
49 ps = ';';
50 path1 = strrep(path1,'/','\');
51 path2 = strrep(path2,'/','\');
52 path1Cased = lower(path1);
53 path2Cased = lower(path2);
54 ppCased = lower(pp);
1 55 else
1 56 ps = ':';
1 57 path1Cased = path1;
1 58 path2Cased = path2;
1 59 ppCased = pp;
1 60 end
61
1 62 if isempty(path1Cased)
63 if ~strcmp(ppCased,path2Cased), matlabpath(path2), end
1 64 elseif isempty(path2Cased)
65 if ~strcmp(ppCased,path1Cased), matlabpath(path1), end
1 66 else
67 % Check for special cases path(path1,path) or path(path,path2)
1 68 if strcmp(ppCased,path1Cased), append = 1; else append = 0; end
69
70 % Add path separator to path1 and path2
1 71 if ~isempty(path1Cased) && path1Cased(end)~=ps, path1 = [path1 ps]; end
1 72 if ~isempty(path2Cased) && path2Cased(end)~=ps, path2 = [path2 ps]; end
73
1 74 cPath1 = parsedirs(path1);
0.01 1 75 cPath2 = parsedirs(path2);
76
77 % Use "Cased" variables for comparisons,
78 % but do real work on cPath1 and cPath2
1 79 if strncmp(computer,'PC',2)
80 cPath1Cased = lower(cPath1);
81 cPath2Cased = lower(cPath2);
1 82 else
1 83 cPath1Cased = cPath1;
1 84 cPath2Cased = cPath2;
1 85 end
86
87 % Loop through path to see if we're adding existing paths
88 % If so, move them to the beginning or end as specified
89 % On Windows, search without case, but use actual inputs when
90 % calling MATLABPATH to preserve case
1 91 if append
92 pmatch = false(size(cPath1));
93 for n=1:length(cPath2Cased)
94 pmatch = pmatch | strcmp(cPath2Cased{n},cPath1Cased);
95 end
96 cPath1(pmatch) = [];
1 97 else
1 98 pmatch = false(size(cPath2));
1 99 for n=1:length(cPath1Cased)
1 100 pmatch = pmatch | strcmp(cPath1Cased{n},cPath2Cased);
1 101 end
1 102 cPath2(pmatch) = [];
1 103 end
104
1 105 if isempty(cPath2),
106 matlabpath(path1);
1 107 elseif isempty(cPath1)
108 matlabpath(path2);
1 109 else
0.01 1 110 matlabpath([cPath1{:} cPath2{:}]);
1 111 end
1 112 end
1 113 end
114
1 115 if nargout==1, p = matlabpath; end