This is a static copy of a profile report

Home

optimget (208 calls, 0.020 sec)
Generated 14-Nov-2016 07:47:11 using cpu time.
function in file /usr/local/MATLAB/MATLAB_Production_Server/R2015a/toolbox/matlab/optimfun/optimget.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
fminsearchfunction208
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
24
o = optimgetfast(options,name,...
2080.020 s100.0%
25
return
2080 s0%
23
if (nargin == 4) && is...
2080 s0%
All other lines  0 s0%
Totals  0.020 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
optimget>optimgetfastsubfunction2080.020 s100.0%
Self time (built-ins, overhead, etc.)  0 s0%
Totals  0.020 s100% 
Code Analyzer results
Line numberMessage
66The variable 'msg' appears to change size on every loop iteration. Consider preallocating for speed.
Coverage results
Show coverage for parent directory
Total lines in function80
Non-code lines (comments, blank lines)32
Code lines (lines that can run)48
Code lines that did run3
Code lines that did not run45
Coverage (did run/can run)6.25 %
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-2011 The MathWorks, Inc.
  21 

  22 
% undocumented usage for fast access with no error checking
    208 
  23 
if (nargin == 4) && isequal(flag,'fast') 
  0.02 
    208 
  24 
    o = optimgetfast(options,name,default); 
    208 
  25 
    return 
  26 
end
  27 

  28 
if nargin < 2
  29 
    error(message('MATLAB:optimget:NotEnoughInputs'));
  30 
end
  31 
if nargin < 3
  32 
    default = [];
  33 
end
  34 

  35 
if ~isempty(options) && ~isa(options,'struct')
  36 
    error(message('MATLAB:optimget:Arg1NotStruct'));
  37 
end
  38 

  39 
if isempty(options)
  40 
    o = default;
  41 
    return;
  42 
end
  43 

  44 
allfields = {'Display'; 'MaxFunEvals';'MaxIter';'TolFun';'TolX';'FunValCheck';'OutputFcn';'PlotFcns'};
  45 

  46 
% Include specialized options if appropriate
  47 
if uselargeoptimstruct
  48 
    optimfields = optimoptiongetfields;  
  49 
    allfields = [allfields; optimfields];
  50 
end
  51 

  52 
Names = allfields;
  53 

  54 
name = deblank(name(:)'); % force this to be a row vector
  55 
j = find(strncmpi(name,Names,length(name)));
  56 
if isempty(j)               % if no matches
  57 
    error(message('MATLAB:optimget:InvalidPropName', name));
  58 
elseif length(j) > 1            % if more than one match
  59 
    % Check for any exact matches (in case any names are subsets of others)
  60 
    k = find(strcmpi(name,Names));
  61 
    if length(k) == 1
  62 
        j = k;
  63 
    else
  64 
        msg = ['(' Names{j(1),:}];
  65 
        for k = j(2:length(j))'
  66 
            msg = [msg ', ' Names{k,:}];
  67 
        end
  68 
        msg = [msg, '.)'];
  69 
        error(message('MATLAB:optimget:AmbiguousPropName', name, msg));
  70 
    end
  71 
end
  72 

  73 
if any(strcmp(Names,Names{j,:}))
  74 
    o = options.(Names{j,:});
  75 
    if isempty(o)
  76 
        o = default;
  77 
    end
  78 
else
  79 
    o = default;
  80 
end

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