This is a static copy of a profile reportHome
ml_initparam (1019 calls, 0.200 sec)
Generated 05-Nov-2014 07:52:27 using cpu time.
function in file /usr0/home/jenkins/workspace/cellorganizer-demo3D11-glnx64/utilities/ml_initparam.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 |
63 | defaultParameterValue = ... | 826 | 0.110 s | 55.0% |  |
65 | if ~isfield(param,defaultParam... | 826 | 0.020 s | 10.0% |  |
74 | end | 818 | 0.010 s | 5.0% |  |
69 | if isstruct(defaultParameterVa... | 818 | 0.010 s | 5.0% |  |
68 | else | 818 | 0.010 s | 5.0% |  |
All other lines | | | 0.040 s | 20.0% |  |
Totals | | | 0.200 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
getfield | function | 826 | 0.100 s | 50.0% |  |
setfield | function | 8 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.100 s | 50.0% |  |
Totals | | | 0.200 s | 100% | |
Code Analyzer results
Line number | Message |
64 | Use dynamic fieldnames with structures instead of GETFIELD. |
66 | Use dynamic fieldnames with structures instead of SETFIELD. |
70 | Use dynamic fieldnames with structures instead of GETFIELD. |
71 | Use dynamic fieldnames with structures instead of SETFIELD. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 75 |
Non-code lines (comments, blank lines) | 56 |
Code lines (lines that can run) | 19 |
Code lines that did run | 13 |
Code lines that did not run | 6 |
Coverage (did run/can run) | 68.42 % |
Function listing
time calls line
1 function param = ml_initparam(param,paramdefault)
2 %TZ_INITPARAM Initialize parameters.
3 % PARAM2 = TZ_INITPARAM(PARAM,PARAMDEFAULT) returns the initialized
4 % parameter. PARAM and PARAMDEFAULT are both structures. All fields
5 % in PARAM will be kept unchanged in PARAM2. And all fields in
6 % PARAMDEFAULT but not in PARAM will be added to PARAM2. If a field is a
7 % structure, parameter initialization will go down herachically.
8 %
9 % Example:
10 % param2 = ml_initparam(struct('t',1,'t2',2),struct('t2',3,'t3',4))
11 % returns
12 % param2 =
13 % t: 1
14 % t2: 2
15 % t3: 4
16 %
17 % param2 = ml_initparam(struct('t',1,'t2',struct('t3',2)), ...
18 % struct('t1',3,'t2',struct('t4',4)))
19 % returns
20 % param2 =
21 % t: 1
22 % t2: struct('t3',2,'t4',4)
23 % t1: 3
24 %
25 % See also
26
27 % Copyright (C) 2006 Murphy Lab
28 % Carnegie Mellon University
29 %
30 % This program is free software; you can redistribute it and/or modify
31 % it under the terms of the GNU General Public License as published
32 % by the Free Software Foundation; either version 2 of the License,
33 % or (at your option) any later version.
34 %
35 % This program is distributed in the hope that it will be useful, but
36 % WITHOUT ANY WARRANTY; without even the implied warranty of
37 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38 % General Public License for more details.
39 %
40 % You should have received a copy of the GNU General Public License
41 % along with this program; if not, write to the Free Software
42 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
43 % 02110-1301, USA.
44 %
45 % For additional information visit http://murphylab.web.cmu.edu or
46 % send email to murphy@cmu.edu
47
48 % 18-Nov-2005 Initial write T. Zhao
49 % Copyright (c) Center for Bioimage Informatics, CMU
50
0.01 1019 51 if nargin < 2
52 error('Exactly 2 arguments are required')
53 end
54
0.01 1019 55 if isempty(param)
203 56 param = paramdefault;
203 57 return;
58 end
59
0.01 816 60 defaultParameterNames = fieldnames(paramdefault);
61
816 62 for k=1:length(defaultParameterNames)
0.11 826 63 defaultParameterValue = ...
64 getfield(paramdefault,defaultParameterNames{k});
0.02 826 65 if ~isfield(param,defaultParameterNames{k})
8 66 param = setfield(param,defaultParameterNames{k}, ...
67 defaultParameterValue);
0.01 818 68 else
0.01 818 69 if isstruct(defaultParameterValue)
70 parameterValue = getfield(param,defaultParameterNames{k});
71 param = setfield(param,defaultParameterNames{k}, ...
72 ml_initparam(parameterValue,defaultParameterValue));
73 end
0.01 818 74 end
826 75 end