This is a static copy of a profile report

Home

path (2 calls, 0.101 sec)
Generated 14-Nov-2016 07:47:09 using cpu time.
function in file /usr/local/MATLAB/MATLAB_Production_Server/R2015a/toolbox/matlab/general/path.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
addpathfunction2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
109
matlabpath([cPath1{:} cPath2{:...
20.050 s50.0%
74
cPath2 = parsedirs(path2);
20.050 s50.0%
114
if nargout==1, p = matlabpath;...
20 s0%
112
end
20 s0%
111
end
20 s0%
All other lines  0 s0%
Totals  0.101 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
general/private/parsedirsfunction40.050 s50.0%
Self time (built-ins, overhead, etc.)  0.050 s50.0%
Totals  0.101 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function114
Non-code lines (comments, blank lines)50
Code lines (lines that can run)64
Code lines that did run41
Code lines that did not run23
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-2011 The MathWorks, Inc.
  27 

      2 
  28 
if nargin == 0  % Pretty-print 
  29 
    if nargout == 0
  30 
        matlabpath
  31 
    end
      2 
  32 
elseif nargin == 1 
  33 
    matlabpath(path1) % matlabpath will check and process path1
      2 
  34 
elseif nargin == 2 
      2 
  35 
    if ~ischar(path1) || ~ischar(path2) 
  36 
        error(message('MATLAB:string'))
  37 
    end
  38 
    
  39 
    % If path1 is contained in path2 or vice versa, don't add it
      2 
  40 
    pp = matlabpath; 
  41 
    
  42 
    % Windows is case-insensitive
  43 
    % Use "Cased" variables for comparisons, 
  44 
    %   but do real work on path1 and path2
  45 
	% Define FILESEP and PATHSEP, since these are not built-in
  46 
	% and PATH might be called with an empty MATLAB path
      2 
  47 
    if strncmp(computer,'PC',2) 
  48 
        ps = ';';
  49 
        path1 = strrep(path1,'/','\');
  50 
        path2 = strrep(path2,'/','\');
  51 
        path1Cased  = lower(path1);
  52 
        path2Cased  = lower(path2);
  53 
        ppCased = lower(pp);
      2 
  54 
    else 
      2 
  55 
        ps = ':'; 
      2 
  56 
        path1Cased = path1; 
      2 
  57 
        path2Cased = path2; 
      2 
  58 
        ppCased = pp; 
      2 
  59 
    end 
  60 
    
      2 
  61 
    if isempty(path1Cased) 
  62 
        if ~strcmp(ppCased,path2Cased), matlabpath(path2), end
      2 
  63 
    elseif isempty(path2Cased) 
  64 
        if ~strcmp(ppCased,path1Cased), matlabpath(path1), end
      2 
  65 
    else 
  66 
        % Check for special cases path(path1,path) or path(path,path2)
      2 
  67 
        if strcmp(ppCased,path1Cased), append = 1; else append = 0; end 
  68 
        
  69 
        % Add path separator to path1 and path2
      2 
  70 
        if ~isempty(path1Cased) && path1Cased(end)~=ps, path1 = [path1 ps]; end 
      2 
  71 
        if ~isempty(path2Cased) && path2Cased(end)~=ps, path2 = [path2 ps]; end 
  72 

      2 
  73 
        cPath1 = parsedirs(path1); 
  0.05 
      2 
  74 
        cPath2 = parsedirs(path2); 
  75 
        
  76 
        % Use "Cased" variables for comparisons, 
  77 
        %   but do real work on cPath1 and cPath2
      2 
  78 
        if strncmp(computer,'PC',2) 
  79 
            cPath1Cased  = lower(cPath1);
  80 
            cPath2Cased  = lower(cPath2);
      2 
  81 
        else 
      2 
  82 
            cPath1Cased = cPath1; 
      2 
  83 
            cPath2Cased = cPath2; 
      2 
  84 
        end 
  85 
        
  86 
        % Loop through path to see if we're adding existing paths
  87 
        % If so, move them to the beginning or end as specified
  88 
        % On Windows, search without case, but use actual inputs when
  89 
        % calling MATLABPATH to preserve case
      2 
  90 
        if append 
  91 
            pmatch = false(size(cPath1));
  92 
            for n=1:length(cPath2Cased)
  93 
                pmatch = pmatch | strcmp(cPath2Cased{n},cPath1Cased);
  94 
            end
  95 
            cPath1(pmatch) = [];
      2 
  96 
        else 
      2 
  97 
            pmatch = false(size(cPath2)); 
      2 
  98 
            for n=1:length(cPath1Cased) 
      2 
  99 
                pmatch = pmatch | strcmp(cPath1Cased{n},cPath2Cased); 
      2 
 100 
            end 
      2 
 101 
            cPath2(pmatch) = []; 
      2 
 102 
        end 
 103 

      2 
 104 
        if isempty(cPath2), 
 105 
            matlabpath(path1);
      2 
 106 
        elseif isempty(cPath1) 
 107 
            matlabpath(path2);
      2 
 108 
        else 
  0.05 
      2 
 109 
            matlabpath([cPath1{:} cPath2{:}]); 
      2 
 110 
        end 
      2 
 111 
    end 
      2 
 112 
end 
 113 
        
      2 
 114 
if nargout==1, p = matlabpath; end