This is a static copy of a profile reportHome
ml_ls (20 calls, 0.561 sec)
Generated 05-Nov-2014 07:52:33 using cpu time.
function in file /usr0/home/jenkins/workspace/cellorganizer-demo3D11-glnx64/utilities/ml_ls.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 |
52 | temp = strread( rows{i},'%s','... | 1616 | 0.280 s | 50.0% |  |
64 | files = sort_nat( files ); | 20 | 0.200 s | 35.7% |  |
47 | list = ls( patterns{c} ); | 20 | 0.030 s | 5.4% |  |
55 | files{length(files)+1} = temp{... | 1616 | 0.020 s | 3.6% |  |
48 | rows = strread( list, '%s', 'd... | 20 | 0.020 s | 3.6% |  |
All other lines | | | 0.010 s | 1.8% |  |
Totals | | | 0.561 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
strread | function | 1636 | 0.260 s | 46.4% |  |
sort_nat | function | 20 | 0.190 s | 33.9% |  |
ls | function | 20 | 0.030 s | 5.4% |  |
Self time (built-ins, overhead, etc.) | | | 0.080 s | 14.3% |  |
Totals | | | 0.561 s | 100% | |
Code Analyzer results
Line number | Message |
48 | STRREAD will be removed in a future release. Use TEXTSCAN instead. |
51 | The value assigned to variable 'temp' might be unused. |
52 | STRREAD will be removed in a future release. Use TEXTSCAN instead. |
55 | The variable 'files' appears to change size on every loop iteration. Consider preallocating for speed. |
59 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
66 | The variable 'patternnum' appears to change size on every loop iteration. Consider preallocating for speed. |
71 | FOR might not be aligned with its matching END (line 94). |
75 | STRREAD will be removed in a future release. Use TEXTSCAN instead. |
78 | The value assigned to variable 'temp' might be unused. |
79 | STRREAD will be removed in a future release. Use TEXTSCAN instead. |
82 | The variable 'files' appears to change size on every loop iteration. Consider preallocating for speed. |
86 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
93 | The variable 'patternnum' appears to change size on every loop iteration. Consider preallocating for speed. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 99 |
Non-code lines (comments, blank lines) | 45 |
Code lines (lines that can run) | 54 |
Code lines that did run | 27 |
Code lines that did not run | 27 |
Coverage (did run/can run) | 50.00 % |
Function listing
time calls line
1 function [allfiles, patternnum] = ml_ls( patterns )
2 % FILELISTING = ML_LS( PATTERN ) Returns file listing of wildcard PATTERN (e.g. '*.jpg').
3 % FILELISTING is a cell array of strings of filenames without path.
4 % the listing is sorted by name alphabetically
5 %
6
7 % 8/11/13 G. Johnson - modified such that pattern can be a string, or cell
8 % array of strings, in case of the need for multiple
9 % source directories
10 %
11 % Copyright (C) 2006-2013 Murphy Lab
12 % Lane Center for Computational Biology
13 % School of Computer Science
14 % Carnegie Mellon University
15 %
16 % This program is free software; you can redistribute it and/or modify
17 % it under the terms of the GNU General Public License as published
18 % by the Free Software Foundation; either version 2 of the License,
19 % or (at your option) any later version.
20 %
21 % This program is distributed in the hope that it will be useful, but
22 % WITHOUT ANY WARRANTY; without even the implied warranty of
23 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 % General Public License for more details.
25 %
26 % You should have received a copy of the GNU General Public License
27 % along with this program; if not, write to the Free Software
28 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29 % 02110-1301, USA.
30 %
31 % For additional information visit http://murphylab.web.cmu.edu or
32 % send email to murphy@cmu.edu
33
20 34 if ~iscell(patterns)
20 35 patterns = {patterns};
20 36 end
37
20 38 allfiles = cell(length(patterns),1);
39
40 %hidden option to the user
20 41 option = 1;
42
20 43 if option == 1
20 44 for c = 1:length(patterns)
20 45 try
20 46 files = {};
0.03 20 47 list = ls( patterns{c} );
0.02 20 48 rows = strread( list, '%s', 'delimiter', ' ');
49 %rows = strread( list, '%s', 'delimiter', sprintf('\n'));
20 50 for i=1:1:length(rows)
1616 51 temp = {};
0.28 1616 52 temp = strread( rows{i},'%s','delimiter','\t');
0.01 1616 53 for j=1:1:length(temp)
1616 54 if ~isempty(temp{j})
0.02 1616 55 files{length(files)+1} = temp{j};
1616 56 end
1616 57 end
1616 58 end
59 catch
60 files = {};
61 end
62
63 %D. Sullivan 6/20/13 - added natural sorting
0.20 20 64 files = sort_nat( files );
20 65 allfiles{c} = files;
20 66 patternnum{c} = ones(1,length(files))*c;
20 67 end
68
20 69 allfiles = [allfiles{:}];
20 70 patternnum = [patternnum{:}];
71 else for c = 1:length(patterns)
72 try
73 files = {};
74 list = ls( patterns{c} );
75 rows = strread( list, '%s', 'delimiter', ' ');
76 %rows = strread( list, '%s', 'delimiter', sprintf('\n'));
77 for i=1:1:length(rows)
78 temp = {};
79 temp = strread( rows{i},'%s','delimiter','\t');
80 for j=1:1:length(temp)
81 if ~isempty(temp{j})
82 files{length(files)+1} = temp{j};
83 end
84 end
85 end
86 catch
87 files = {};
88 end
89
90 %D. Sullivan 6/20/13 - added natural sorting
91 files = sort_nat( files );
92 allfiles{c} = files;
93 patternnum{c} = ones(1,length(files))*c;
94 end
95
96 allfiles = [allfiles{:}];
97 patternnum = [patternnum{:}];
98 end
20 99 end