This is a static copy of a profile report

Home

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)

Function NameFunction TypeCalls
demo3D11function3
img2slmlfunction1
img2modelfunction2
preprocessfunction808
tp_spcylfeatfunction202
ml_estpdffunction1
ml_estcovfunction2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
63
defaultParameterValue = ...
8260.110 s55.0%
65
if ~isfield(param,defaultParam...
8260.020 s10.0%
74
end
8180.010 s5.0%
69
if isstruct(defaultParameterVa...
8180.010 s5.0%
68
else
8180.010 s5.0%
All other lines  0.040 s20.0%
Totals  0.200 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
getfieldfunction8260.100 s50.0%
setfieldfunction80 s0%
Self time (built-ins, overhead, etc.)  0.100 s50.0%
Totals  0.200 s100% 
Code Analyzer results
Line numberMessage
64Use dynamic fieldnames with structures instead of GETFIELD.
66Use dynamic fieldnames with structures instead of SETFIELD.
70Use dynamic fieldnames with structures instead of GETFIELD.
71Use dynamic fieldnames with structures instead of SETFIELD.
Coverage results
[ Show coverage for parent directory ]
Total lines in function75
Non-code lines (comments, blank lines)56
Code lines (lines that can run)19
Code lines that did run13
Code lines that did not run6
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