This is a static copy of a profile report

Home

finfo (4 calls, 0.208 sec)
Generated 05-Aug-2011 13:01:21 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/general/finfo.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
importdatafunction4
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
36
[ext, description] = getExtens...
40.131 s63.2%
107
description = fread(fid,1024*1...
40.044 s21.1%
101
elseif ~isempty(ext) &&...
40.011 s5.3%
77
openAction = which(['open' ext...
40.011 s5.3%
44
ext = strtok(ext,'.');
40.011 s5.3%
All other lines  0 s0%
Totals  0.208 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
finfo>getExtensionsubfunction40.131 s63.2%
strtokfunction40.011 s5.3%
cell.strmatchfunction40 s0%
Self time (built-ins, overhead, etc.)  0.066 s31.6%
Totals  0.208 s100% 
Code Analyzer results
Line numberMessage
43FINDSTR will be removed in a future release. Use STRFIND instead.
60STRMATCH will be removed in a future release. Replace STRMATCH(STR, STRARRAY, 'exact') with STRCMP(STR, STRARRAY).
91The value assigned here to 'p' appears to be unused. Consider replacing it by ~.
94The value assigned here to 'p' appears to be unused. Consider replacing it by ~.
Coverage results
[ Show coverage for parent directory ]
Total lines in function122
Non-code lines (comments, blank lines)52
Code lines (lines that can run)70
Code lines that did run41
Code lines that did not run29
Coverage (did run/can run)58.57 %
Function listing
   time   calls  line
1 function [fileType, openAction, loadAction, description] = finfo(filename, ext)
2 % FINFO Identify file type against standard file handlers on path
3 %
4 % [TYPE, OPENCMD, LOADCMD, DESCR] = finfo(FILENAME)
5 %
6 % TYPE - contains type for FILENAME or 'unknown'.
7 %
8 % OPENCMD - contains command to OPEN or EDIT the FILENAME or empty if
9 % no handler is found or FILENAME is not readable.
10 %
11 % LOADCMD - contains command to LOAD data from FILENAME or empty if
12 % no handler is found or FILENAME is not readable.
13 %
14 % DESCR - contains description of FILENAME or error message if
15 % FILENAME is not readable.
16 %
17 % See OPEN, LOAD
18
19 % Copyright 1984-2008 The MathWorks, Inc.
20 % $Revision: 1.19.4.16 $ $Date: 2010/08/23 23:09:33 $
21
4 22 if ~ischar(filename)
23 error(message('MATLAB:finfo:InvalidType'));
24 end
25
4 26 if exist(filename,'file') == 0
27 error(message('MATLAB:finfo:FileNotFound', filename))
28 end
29
4 30 if nargin == 2 && ~ischar(ext)
31 error(message('MATLAB:finfo:ExtensionMustBeAString'));
32 end
33
34 % get file extension
4 35 if nargin == 1 || isempty(ext)
0.13 4 36 [ext, description] = getExtension(filename);
37 else
38 description = '';
39 end
4 40 ext = lower(ext);
41
42 % rip leading . from ext
4 43 if ~isempty(findstr(ext,'.'))
0.01 4 44 ext = strtok(ext,'.');
4 45 end
46
47 % special case for .text files (textread will give false positive)
4 48 if strcmp(ext,'text')
49 ext = '';
50 end
51
52 % check if open and load handlers exist
4 53 openAction = '';
4 54 loadAction = '';
55
56 % this setup will not allow users to override the default EXTread behavior
4 57 if ~isempty(ext)
58 % known data formats go to uiimport and importdata
4 59 if strncmp(ext, 'xls', 3) || ... %Excel file extensions START with xls
60 ~isempty(strmatch(ext, ...
61 {'avi', ... % movie files
62 'au' , 'snd', 'wav', ... % audio files
63 'csv', 'dat', 'dlm', 'tab', ... % text files
64 'wk1', ... % other worksheet files
65 'im'}, ... % image files (see getExtension below)
66 'exact'))
67 openAction = 'uiimport';
68 loadAction = 'importdata';
4 69 else
70 %special cases for DOC and PPT formats
4 71 if strncmp(ext, 'doc', 3)
72 openAction = 'opendoc';
4 73 elseif strncmp(ext, 'ppt', 3)
74 openAction = 'openppt';
4 75 else
76 % unknown data format, try to find handler on the path
0.01 4 77 openAction = which(['open' ext]);
4 78 loadAction = which([ext 'read']);
4 79 end
4 80 end
4 81 end
82
4 83 if ~isempty(openAction) || ~isempty(loadAction)
84 fileType = ext;
4 85 else
4 86 fileType = 'unknown';
4 87 end
88
89 % rip path stuff off commands
4 90 if ~isempty(openAction)
91 [p,openAction] = fileparts(openAction);
92 end
4 93 if ~isempty(loadAction)
94 [p,loadAction] = fileparts(loadAction);
95 end
96
97 % make nice description and validate file format
4 98 if nargout == 4 && isempty(description) % only fetch descr if necessary
4 99 if (strncmp(ext, 'xls', 3))
100 [status, description] = xlsfinfo(filename);
0.01 4 101 elseif ~isempty(ext) && ~isempty(which([ext 'finfo']))
102 [status, description] = feval([ext 'finfo'], filename);
4 103 else
104 % no finfo for this file, give back contents
4 105 fid = fopen(filename);
4 106 if fid > 0
0.04 4 107 description = fread(fid,1024*1024,'*char')';
4 108 fclose(fid);
109 else
110 description = 'File not found';
111 end
4 112 status = 'NotFound';
4 113 end
4 114 if isempty(status)
115 % the file finfo util sez this is a bogus file.
116 % return valid file type but empty actions
117 openAction = '';
118 loadAction = '';
119 % generate failure message, used by IMPORTDATA
120 description = 'FileInterpretError';
121 end
4 122 end

Other subfunctions in this file are not included in this listing.