This is a static copy of a profile reportHome
optimset>checkfield (6880 calls, 0.601 sec)
Generated 05-Aug-2011 13:03:53 using cpu time.
subfunction in file /usr/local/MATLAB/R2011a/toolbox/matlab/funfun/optimset.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
optimset | function | 6880 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
279 | [optvalidvalue, opterrmsg, opt... | 1720 | 0.186 s | 30.9% |  |
261 | [validvalue, errmsg, errid] = ... | 3440 | 0.066 s | 10.9% |  |
250 | validfield = true; | 6880 | 0.055 s | 9.1% |  |
269 | errmsg = sprintf('Unrecognized... | 1720 | 0.033 s | 5.5% |  |
258 | [validvalue, errmsg, errid] = ... | 1720 | 0.033 s | 5.5% |  |
All other lines | | | 0.230 s | 38.2% |  |
Totals | | | 0.601 s | 100% | |
Children (called functions)
Code Analyzer results
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 58 |
Non-code lines (comments, blank lines) | 19 |
Code lines (lines that can run) | 39 |
Code lines that did run | 24 |
Code lines that did not run | 15 |
Coverage (did run/can run) | 61.54 % |
Function listing
time calls line
235 function checkfield(field,value,optimtbx)
236 %CHECKFIELD Check validity of structure field contents.
237 % CHECKFIELD('field',V,OPTIMTBX) checks the contents of the specified
238 % value V to be valid for the field 'field'. OPTIMTBX indicates if
239 % the Optimization Toolbox is on the path.
240 %
241
242 % empty matrix is always valid
0.03 6880 243 if isempty(value)
244 return
245 end
246
247 % See if it is one of the valid MATLAB fields. It may be both an Optim
248 % and MATLAB field, e.g. MaxFunEvals, in which case the MATLAB valid
249 % test may fail and the Optim one may pass.
0.05 6880 250 validfield = true;
0.01 6880 251 switch field
0.02 6880 252 case {'TolFun'} % real scalar
253 [validvalue, errmsg, errid] = nonNegReal(field,value);
6880 254 case {'TolX'} % real scalar
255 % this string is for LSQNONNEG
256 [validvalue, errmsg, errid] = nonNegReal(field,value,'10*eps*norm(c,1)*length(c)');
0.02 6880 257 case {'Display'} % several character strings
0.03 1720 258 [validvalue, errmsg, errid] = displayType(field,value);
5160 259 case {'MaxFunEvals','MaxIter'} % integer including inf or default string
260 % this string is for FMINSEARCH
0.07 3440 261 [validvalue, errmsg, errid] = nonNegInteger(field,value,'200*numberofvariables');
1720 262 case {'FunValCheck'} % off,on
263 [validvalue, errmsg, errid] = onOffType(field,value);
1720 264 case {'OutputFcn','PlotFcns'}% function
265 [validvalue, errmsg, errid] = functionOrCellArray(field,value);
0.02 1720 266 otherwise
1720 267 validfield = false;
1720 268 validvalue = false;
0.03 1720 269 errmsg = sprintf('Unrecognized parameter name ''%s''.', field);
0.01 1720 270 errid = 'MATLAB:optimset:checkfield:InvalidParamName';
1720 271 end
272
0.01 6880 273 if validvalue
0.01 5160 274 return;
0.02 1720 275 elseif ~optimtbx && validfield
276 % Throw the MATLAB invalid value error
277 error(errid, errmsg);
1720 278 else % Check if valid for Optim Tbx
0.19 1720 279 [optvalidvalue, opterrmsg, opterrid, optvalidfield] = optimoptioncheckfield(field,value);
1720 280 if optvalidvalue
1720 281 return;
282 elseif optvalidfield
283 % Throw the Optim invalid value error
284 ME = MException(opterrid,opterrmsg);
285 throwAsCaller(ME);
286 else % Neither field nor value is valid for Optim
287 % Throw the MATLAB invalid value error (can't be invalid field for
288 % MATLAB & Optim or would have errored already in optimset).
289 ME = MException(errid,errmsg);
290 throwAsCaller(ME);
291 end
292 end
Other subfunctions in this file are not included in this listing.