This is a static copy of a profile report

Home

optimset>checkfield (78 calls, 0.010 sec)
Generated 14-Nov-2016 07:47:10 using cpu time.
subfunction in file /usr/local/MATLAB/MATLAB_Production_Server/R2015a/toolbox/matlab/optimfun/optimset.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
optimsetfunction78
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
297
return;
780 s0%
296
if validvalue 
780 s0%
286
[validvalue, errmsg, errid] = ...
260 s0%
285
case {'FunValCheck'} % off,on
260 s0%
284
[validvalue, errmsg, errid] = ...
260 s0%
All other lines  0.010 s100.0%
Totals  0.010 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
optimset>nonNegIntegersubfunction260 s0%
optimset>onOffTypesubfunction260 s0%
optimset>displayTypesubfunction260 s0%
Self time (built-ins, overhead, etc.)  0.010 s100.0%
Totals  0.010 s100% 
Code Analyzer results
Line numberMessage
Coverage results
Show coverage for parent directory
Total lines in function59
Non-code lines (comments, blank lines)19
Code lines (lines that can run)40
Code lines that did run13
Code lines that did not run27
Coverage (did run/can run)32.50 %
Function listing
time 
calls 
 line
 258 
function value = checkfield(field,value,optimtbx)
 259 
%CHECKFIELD Check validity of structure field contents.
 260 
%   CHECKFIELD('field',V,OPTIMTBX) checks the contents of the specified
 261 
%   value V to be valid for the field 'field'. OPTIMTBX indicates if 
 262 
%   the Optimization Toolbox is on the path.
 263 
%
 264 

 265 
% empty matrix is always valid
     78 
 266 
if isempty(value) 
 267 
    return
 268 
end
 269 

 270 
% See if it is one of the valid MATLAB fields.  It may be both an Optim
 271 
% and MATLAB field, e.g. MaxFunEvals, in which case the MATLAB valid
 272 
% test may fail and the Optim one may pass.
     78 
 273 
validfield = true; 
     78 
 274 
switch field 
     78 
 275 
    case {'TolFun'} % real scalar 
 276 
        [validvalue, errmsg, errid] = nonNegReal(field,value);
     78 
 277 
    case {'TolX'} % real scalar 
 278 
        % this string is for LSQNONNEG
 279 
        [validvalue, errmsg, errid] = nonNegReal(field,value,'10*eps*norm(c,1)*length(c)');
     78 
 280 
    case {'Display'} % several character strings 
     26 
 281 
        [validvalue, errmsg, errid] = displayType(field,value); 
     52 
 282 
    case {'MaxFunEvals','MaxIter'} % integer including inf or default string 
 283 
        % this string is for FMINSEARCH
     26 
 284 
        [validvalue, errmsg, errid] = nonNegInteger(field,value,'200*numberofvariables'); 
     26 
 285 
    case {'FunValCheck'} % off,on 
     26 
 286 
        [validvalue, errmsg, errid] = onOffType(field,value); 
 287 
    case {'OutputFcn','PlotFcns'}% function
 288 
        [validvalue, errmsg, errid] = functionOrCellArray(field,value);
 289 
    otherwise
 290 
        validfield = false;  
 291 
        validvalue = false;
 292 
        errid = 'MATLAB:optimset:InvalidParamName';
 293 
        errmsg = getString(message(errid, field));
 294 
end
 295 

     78 
 296 
if validvalue  
     78 
 297 
    return; 
 298 
elseif ~optimtbx && validfield  
 299 
    % Throw the MATLAB invalid value error
 300 
    ME = MException(errid,'%s',errmsg);
 301 
    throwAsCaller(ME);
 302 
else % Check if valid for Optim Tbx
 303 
    [value, optvalidvalue, opterrmsg, opterrid, optvalidfield] = optimoptioncheckfield(field,value);
 304 
    if optvalidvalue
 305 
        return;
 306 
    elseif optvalidfield
 307 
        % Throw the Optim invalid value error
 308 
        ME = MException(opterrid,'%s',opterrmsg);
 309 
        throwAsCaller(ME);
 310 
    else % Neither field nor value is valid for Optim
 311 
        % Throw the MATLAB invalid value error (can't be invalid field for
 312 
        % MATLAB & Optim or would have errored already in optimset).
 313 
        ME = MException(errid,'%s',errmsg);
 314 
        throwAsCaller(ME);
 315 
    end
 316 
end

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