This is a static copy of a profile report

Home

optimget (41360 calls, 2.896 sec)
Generated 05-Aug-2011 13:03:51 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/funfun/optimget.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
fminsearchfunction6960
fminconfunction6880
getNumericOrStringFieldValuefunction4300
getIpOptionsfunction23220
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
25
o = optimgetfast(options,name,...
413601.978 s68.3%
24
if (nargin == 4) && is...
413600.514 s17.7%
26
return
413600.066 s2.3%
All other lines  0.339 s11.7%
Totals  2.896 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
optimget>optimgetfastsubfunction413601.683 s58.1%
Self time (built-ins, overhead, etc.)  1.213 s41.9%
Totals  2.896 s100% 
Code Analyzer results
Line numberMessage
68The variable 'msg' appears to change size on every loop iteration. Consider preallocating for speed.
Coverage results
[ Show coverage for parent directory ]
Total lines in function82
Non-code lines (comments, blank lines)33
Code lines (lines that can run)49
Code lines that did run3
Code lines that did not run46
Coverage (did run/can run)6.12 %
Function listing
   time   calls  line
1 function o = optimget(options,name,default,flag)
2 %OPTIMGET Get OPTIM OPTIONS parameters.
3 % VAL = OPTIMGET(OPTIONS,'NAME') extracts the value of the named parameter
4 % from optimization options structure OPTIONS, returning an empty matrix if
5 % the parameter value is not specified in OPTIONS. It is sufficient to
6 % type only the leading characters that uniquely identify the
7 % parameter. Case is ignored for parameter names. [] is a valid OPTIONS
8 % argument.
9 %
10 % VAL = OPTIMGET(OPTIONS,'NAME',DEFAULT) extracts the named parameter as
11 % above, but returns DEFAULT if the named parameter is not specified (is [])
12 % in OPTIONS. For example
13 %
14 % val = optimget(opts,'TolX',1e-4);
15 %
16 % returns val = 1e-4 if the TolX parameter is not specified in opts.
17 %
18 % See also OPTIMSET.
19
20 % Copyright 1984-2010 The MathWorks, Inc.
21 % $Revision: 1.20.4.16 $ $Date: 2010/11/17 11:26:33 $
22
23 % undocumented usage for fast access with no error checking
0.51 41360 24 if (nargin == 4) && isequal(flag,'fast')
1.98 41360 25 o = optimgetfast(options,name,default);
0.07 41360 26 return
27 end
28
29 if nargin < 2
30 error(message('MATLAB:optimget:NotEnoughInputs'));
31 end
32 if nargin < 3
33 default = [];
34 end
35
36 if ~isempty(options) && ~isa(options,'struct')
37 error(message('MATLAB:optimget:Arg1NotStruct'));
38 end
39
40 if isempty(options)
41 o = default;
42 return;
43 end
44
45 allfields = {'Display'; 'MaxFunEvals';'MaxIter';'TolFun';'TolX';'FunValCheck';'OutputFcn';'PlotFcns'};
46
47 % Include specialized options if appropriate
48 if uselargeoptimstruct
49 optimfields = optimoptiongetfields;
50 allfields = [allfields; optimfields];
51 end
52
53 Names = allfields;
54
55 name = deblank(name(:)'); % force this to be a row vector
56 j = find(strncmpi(name,Names,length(name)));
57 if isempty(j) % if no matches
58 error(message('MATLAB:optimget:InvalidPropName', name));
59 elseif length(j) > 1 % if more than one match
60 % Check for any exact matches (in case any names are subsets of others)
61 k = find(strcmpi(name,Names));
62 if length(k) == 1
63 j = k;
64 else
65 msg = sprintf('Ambiguous option name ''%s'' ', name);
66 msg = [msg '(' Names{j(1),:}];
67 for k = j(2:length(j))'
68 msg = [msg ', ' Names{k,:}];
69 end
70 msg = [msg, '.)'];
71 error('MATLAB:optimget:AmbiguousPropName', msg);
72 end
73 end
74
75 if any(strcmp(Names,Names{j,:}))
76 o = options.(Names{j,:});
77 if isempty(o)
78 o = default;
79 end
80 else
81 o = default;
82 end

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