This is a static copy of a profile report

Home

fileparts (124 calls, 0.044 sec)
Generated 05-Aug-2011 13:01:20 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/iofun/fileparts.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
finfo>getExtensionsubfunction4
graphics/private/namefunction80
printfunction40
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
107
fname(ind:end) = [];
1240.011 s25.0%
92
fname = name(ind+1:end);
1240.011 s25.0%
89
if isempty(deblank(path))
1240.011 s25.0%
53
if ispc
1240.011 s25.0%
108
end
1240 s0%
All other lines  0 s0%
Totals  0.044 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
ispcfunction1240 s0%
Self time (built-ins, overhead, etc.)  0.044 s100.0%
Totals  0.044 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function108
Non-code lines (comments, blank lines)43
Code lines (lines that can run)65
Code lines that did run26
Code lines that did not run39
Coverage (did run/can run)40.00 %
Function listing
   time   calls  line
1 function [path, fname, extension,version] = fileparts(name)
2 %FILEPARTS Filename parts.
3 % [PATHSTR,NAME,EXT] = FILEPARTS(FILE) returns the path, file name, and
4 % file name extension for the specified FILE. The FILE input is a string
5 % containing the name of a file or folder, and can include a path and
6 % file name extension. The function interprets all characters following
7 % the right-most path delimiter as a file name plus extension.
8 %
9 % If the FILE input consists of a folder name only, be sure that the
10 % right-most character is a path delimiter (/ or \). Othewise, FILEPARTS
11 % parses the trailing portion of FILE as the name of a file and returns
12 % it in NAME instead of in PATHSTR.
13 %
14 % FILEPARTS only parses file names. It does not verify that the file or
15 % folder exists. You can reconstruct the file from the parts using
16 % fullfile(pathstr,[name ext versn])
17 %
18 % FILEPARTS is platform dependent.
19 %
20 % On Microsoft Windows systems, you can use either forward (/) or back
21 % (\) slashes as path delimiters, even within the same string. On Unix
22 % and Macintosh systems, use only / as a delimiter.
23 %
24 % See also FULLFILE, PATHSEP, FILESEP.
25
26 % Copyright 1984-2010 The MathWorks, Inc.
27 % $Revision: 1.18.4.13 $ $Date: 2010/08/23 23:10:33 $
28
29 % Nothing but a row vector should be operated on.
124 30 if ~ischar(name) || size(name, 1) > 1
31 error(message('MATLAB:fileparts:MustBeChar'));
32 end
33
124 34 if nargout == 4
35 warning(message('MATLAB:fileparts:VersionToBeRemoved'));
36 end
37
124 38 path = '';
124 39 fname = '';
124 40 extension = '';
124 41 version = '';
42
124 43 if isempty(name)
44 return;
45 end
46
124 47 builtinStr = xlate('built-in');
124 48 if strncmp(name, builtinStr, size(builtinStr,2))
49 fname = builtinStr;
50 return;
51 end
52
0.01 124 53 if ispc
54 ind = find(name == '/'|name == '\', 1, 'last');
55 if isempty(ind)
56 ind = find(name == ':', 1, 'last');
57 if ~isempty(ind)
58 path = name(1:ind);
59 end
60 else
61 if ind == 2 && (name(1) == '\' || name(1) == '/')
62 %special case for UNC server
63 path = name;
64 ind = length(name);
65 else
66 path = name(1:ind-1);
67 end
68 end
69 if isempty(ind)
70 fname = name;
71 else
72 if ~isempty(path) && path(end)==':' && ...
73 (length(path)>2 || (length(name) >=3 && name(3) == '\'))
74 %don't append to D: like which is volume path on windows
75 path = [path '\'];
76 elseif isempty(deblank(path))
77 path = '\';
78 end
79 fname = name(ind+1:end);
80 end
124 81 else % UNIX
124 82 ind = find(name == '/', 1, 'last');
124 83 if isempty(ind)
84 fname = name;
124 85 else
124 86 path = name(1:ind-1);
87
88 % Do not forget to add filesep when in the root filesystem
0.01 124 89 if isempty(deblank(path))
90 path = '/';
91 end
0.01 124 92 fname = name(ind+1:end);
124 93 end
124 94 end
95
124 96 if isempty(fname)
97 return;
98 end
99
100 % Look for EXTENSION part
124 101 ind = find(fname == '.', 1, 'last');
102
124 103 if isempty(ind)
104 return;
124 105 else
124 106 extension = fname(ind:end);
0.01 124 107 fname(ind:end) = [];
124 108 end