This is a static copy of a profile reportHome
general/private/parsedirs (2 calls, 0.011 sec)
Generated 05-Aug-2011 13:00:29 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/general/private/parsedirs.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
path | function | 2 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
42 | cdirs = regexprep(cdirs,sprint... | 2 | 0.011 s | 100.0% |  |
45 | cdirs(cellfun('isempty', cdirs... | 2 | 0 s | 0% |  |
38 | end | 2 | 0 s | 0% |  |
35 | if ~isempty(ix) | 2 | 0 s | 0% |  |
34 | ix = find(strncmp(cdirs,'~',1)... | 2 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.011 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
pathsep | function | 2 | 0 s | 0% |  |
filesep | function | 2 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.011 s | 100.0% |  |
Totals | | | 0.011 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 45 |
Non-code lines (comments, blank lines) | 30 |
Code lines (lines that can run) | 15 |
Code lines that did run | 11 |
Code lines that did not run | 4 |
Coverage (did run/can run) | 73.33 % |
Function listing
time calls line
1 function cdirs = parsedirs(str,varargin)
2 %PARSEDIRS Convert string of directories into a cell array
3 % C = PARSEDIRS(S) converts S, a string of directories separated by path
4 % separators, to C, a cell array of directories.
5 %
6 % The function will clean up each directory name by converting file
7 % separators to the appropriate operating system file separator, and by
8 % ending each cell with a path separator. It will also remove repeated
9 % file and path separators, and insignificant whitespace.
10 %
11 % Example:
12 % cp = parsedirs(path);
13
14 % Copyright 1984-2007 The MathWorks, Inc.
15 % $Revision: 1.1.6.7 $ $Date: 2010/08/23 23:09:55 $
16
2 17 fs = filesep;
2 18 ps = pathsep;
19
2 20 cdirs = regexp(str, sprintf('[^\\s%s;][^%s;]*', ps, ps), 'match')';
21
2 22 if ps == ';'
23 % Only iron fileseps on PC:
24 cdirs = strrep(cdirs,'/','\');
25
26 % Remove repeated "\"s unless they are the start of string
27 % Also ensure a "\" exists after a colon
28 cdirs = regexprep(cdirs, '(:)\s*$|(.)\\{2,}', '$1\');
2 29 else
30 % Remove repeated "/"s
2 31 cdirs = regexprep(cdirs, '/{2,}', '/');
32
33 % Do any tilde expansion
2 34 ix = find(strncmp(cdirs,'~',1));
2 35 if ~isempty(ix)
36 cdirs(ix) = unix_tilde_expansion(cdirs(ix));
37 end
2 38 end
39
40 % Remove trailing fileseps, but allow a directory to be "X:\", "\" or "/"
41 % Add pathseps to the end of all paths
0.01 2 42 cdirs = regexprep(cdirs,sprintf('(.*[^:])\\%s\\s*$|(.+)\\s*$',fs),sprintf('$1%s', ps));
43
44 % Remove empty paths
2 45 cdirs(cellfun('isempty', cdirs)) = [];