This is a static copy of a profile reportHome
addpath (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/addpath.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
read_arc | function | 1 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
87 | path(p, mp); | 1 | 0.033 s | 100.0% |  |
88 | end | 1 | 0 s | 0% |  |
86 | else | 1 | 0 s | 0% |  |
84 | if append | 1 | 0 s | 0% |  |
83 | mp = matlabpath; | 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 |
path | function | 1 | 0.033 s | 100.0% |  |
general/private/catdirs | function | 1 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0 s | 0% |  |
Totals | | | 0.033 s | 100% | |
Code Analyzer results
Line number | Message |
78 | An M-Lint message was once suppressed here, but the message is no longer generated. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 88 |
Non-code lines (comments, blank lines) | 48 |
Code lines (lines that can run) | 40 |
Code lines that did run | 16 |
Code lines that did not run | 24 |
Coverage (did run/can run) | 40.00 % |
Function listing
time calls line
1 function oldpath = addpath(varargin)
2 %ADDPATH Add directory to search path.
3 % ADDPATH DIRNAME prepends the specified directory to the current
4 % matlabpath. Surround the DIRNAME in quotes if the name contains a
5 % space. If DIRNAME is a set of multiple directories separated by path
6 % separators, then each of the specified directories will be added.
7 %
8 % ADDPATH DIR1 DIR2 DIR3 ... prepends all the specified directories to
9 % the path.
10 %
11 % ADDPATH ... -END appends the specified directories.
12 % ADDPATH ... -BEGIN prepends the specified directories.
13 % ADDPATH ... -FROZEN disables directory change detection for directories
14 % being added and thereby conserves Windows change
15 % notification resources (Windows only).
16 %
17 % Use the functional form of ADDPATH, such as ADDPATH('dir1','dir2',...),
18 % when the directory specification is stored in a string.
19 %
20 % P = ADDPATH(...) returns the path prior to adding the specified paths.
21 %
22 % Examples
23 % addpath c:\matlab\work
24 % addpath /home/user/matlab
25 % addpath /home/user/matlab:/home/user/matlab/test:
26 % addpath /home/user/matlab /home/user/matlab/test
27 %
28 % See also RMPATH, PATHTOOL, PATH, SAVEPATH, USERPATH, GENPATH, REHASH.
29
30 % Copyright 1984-2007 The MathWorks, Inc.
31 % $Revision: 1.29.4.11 $ $Date: 2007/12/06 13:29:45 $
32
33 % Number of input arguments
1 34 n = nargin;
1 35 error(nargchk(1,Inf,n,'struct'));
36
1 37 if nargout>0
38 oldpath = path;
39 end
40
1 41 append = -1;
1 42 freeze = 0;
1 43 args = varargin;
44
1 45 while (n > 1)
46 last = args{n};
47 % Append or prepend to the existing path
48 if isequal(last,1) || strcmpi(last,'-end')
49 if (append < 0), append = 1; end;
50 n = n - 1;
51 elseif isequal(last,0) || strcmpi(last,'-begin')
52 if (append < 0), append = 0; end;
53 n = n - 1;
54 elseif strcmpi(last,'-frozen')
55 if ispc, freeze = 1; end
56 n = n - 1;
57 else
58 break;
59 end
60 end
1 61 if (append < 0), append = 0; end
62
63 % Check, trim, and concatenate the input strings
1 64 p = catdirs(varargin{1:n});
65
66 % If p is empty then return
1 67 if isempty(p)
68 return;
69 end
70
71 % See whether frozen is desired, where the state is not already set frozen
1 72 if freeze
73 oldfreeze = system_dependent('DirsAddedFreeze');
74 % Check whether old unfrozen state needs to be restored
75 if ~isempty(strfind(oldfreeze,'unfrozen'))
76 %Use the onCleanup object to automatically restore old state at
77 %exit or error.
78 cleanUp = onCleanup(@()system_dependent('DirsAddedUnfreeze')); %#ok<NASGU>
79 end
80 end
81
82 % Append or prepend the new path
1 83 mp = matlabpath;
1 84 if append
85 path(mp, p);
1 86 else
0.03 1 87 path(p, mp);
1 88 end
Other subfunctions in this file are not included in this listing.