time | calls | line |
---|
| | 83 | function value = optimgetfast(options,name,defaultopt)
|
| | 84 | %OPTIMGETFAST Get OPTIM OPTIONS parameter with no error checking so fast.
|
| | 85 | % VAL = OPTIMGETFAST(OPTIONS,FIELDNAME,DEFAULTOPTIONS) will get the
|
| | 86 | % value of the FIELDNAME from OPTIONS with no error checking or
|
| | 87 | % fieldname completion. If the value is [], it gets the value of the
|
| | 88 | % FIELDNAME from DEFAULTOPTIONS, another OPTIONS structure which is
|
| | 89 | % probably a subset of the options in OPTIONS.
|
| | 90 | %
|
| | 91 |
|
| 208 | 92 | if isempty(options)
|
| | 93 | value = defaultopt.(name);
|
| | 94 | return;
|
| | 95 | end
|
| | 96 | % We need to know if name is a valid field of options, but it is faster to use
|
| | 97 | % a try-catch than to test if the field exists and if the field name is
|
| | 98 | % correct. If the options structure is from an older version of the
|
| | 99 | % toolbox, it could be missing a newer field.
|
| 208 | 100 | try
|
| 208 | 101 | value = options.(name);
|
| | 102 | catch ME
|
| | 103 | value = [];
|
| | 104 | end
|
| | 105 |
|
| 208 | 106 | if isempty(value)
|
0.01 | 130 | 107 | value = defaultopt.(name);
|
| 130 | 108 | end
|
Other subfunctions in this file are not included in this listing.