This is a static copy of a profile reportHome
fileparts (809 calls, 0.230 sec)
Generated 05-Nov-2014 07:52:32 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/matlab/iofun/fileparts.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
48 | if ispc | 809 | 0.060 s | 26.1% |  |
38 | if isempty(file) | 809 | 0.030 s | 13.0% |  |
77 | ind = find(file == '/', 1, 'la... | 809 | 0.020 s | 8.7% |  |
101 | ext = name(ind:end); | 809 | 0.010 s | 4.3% |  |
96 | ind = find(name == '.', 1, 'la... | 809 | 0.010 s | 4.3% |  |
All other lines | | | 0.100 s | 43.5% |  |
Totals | | | 0.230 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
ispc | function | 809 | 0.030 s | 13.0% |  |
Self time (built-ins, overhead, etc.) | | | 0.200 s | 87.0% |  |
Totals | | | 0.230 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 103 |
Non-code lines (comments, blank lines) | 42 |
Code lines (lines that can run) | 61 |
Code lines that did run | 25 |
Code lines that did not run | 36 |
Coverage (did run/can run) | 40.98 % |
Function listing
time calls line
1 function [path, name, ext] = fileparts(file)
2 %FILEPARTS Filename parts.
3 % [PATH,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(path,[name ext])
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.14 $ $Date: 2011/01/28 18:52:12 $
28
29 % Nothing but a row vector should be operated on.
809 30 if ~ischar(file) || size(file, 1) > 1
31 error(message('MATLAB:fileparts:MustBeChar'));
32 end
33
0.01 809 34 path = '';
0.01 809 35 name = '';
0.01 809 36 ext = '';
37
0.03 809 38 if isempty(file)
39 return;
40 end
41
0.01 809 42 builtinStr = xlate('built-in');
809 43 if strncmp(file, builtinStr, size(builtinStr,2))
44 name = builtinStr;
45 return;
46 end
47
0.06 809 48 if ispc
49 ind = find(file == '/'|file == '\', 1, 'last');
50 if isempty(ind)
51 ind = find(file == ':', 1, 'last');
52 if ~isempty(ind)
53 path = file(1:ind);
54 end
55 else
56 if ind == 2 && (file(1) == '\' || file(1) == '/')
57 %special case for UNC server
58 path = file;
59 ind = length(file);
60 else
61 path = file(1:ind-1);
62 end
63 end
64 if isempty(ind)
65 name = file;
66 else
67 if ~isempty(path) && path(end)==':' && ...
68 (length(path)>2 || (length(file) >=3 && file(3) == '\'))
69 %don't append to D: like which is volume path on windows
70 path = [path '\'];
71 elseif isempty(deblank(path))
72 path = '\';
73 end
74 name = file(ind+1:end);
75 end
809 76 else % UNIX
0.02 809 77 ind = find(file == '/', 1, 'last');
809 78 if isempty(ind)
1 79 name = file;
0.01 808 80 else
0.01 808 81 path = file(1:ind-1);
82
83 % Do not forget to add filesep when in the root filesystem
808 84 if isempty(deblank(path))
85 path = '/';
86 end
808 87 name = file(ind+1:end);
808 88 end
809 89 end
90
0.01 809 91 if isempty(name)
92 return;
93 end
94
95 % Look for EXTENSION part
0.01 809 96 ind = find(name == '.', 1, 'last');
97
809 98 if isempty(ind)
99 return;
809 100 else
0.01 809 101 ext = name(ind:end);
809 102 name(ind:end) = [];
809 103 end