time | Calls | line |
---|
| | 51 | function [func, supplied, additionalArgs, results] = validateArguments(func,varargin)
|
| | 52 | %validate input arguments
|
< 0.001 | 2 | 53 | parser = func.Parser;
|
< 0.001 | 2 | 54 | supplied = func.SuppliedStruct;
|
| | 55 |
|
| | 56 | % Process Required Names in order
|
< 0.001 | 2 | 57 | numReq = func.NumRequired;
|
< 0.001 | 2 | 58 | reqNames = func.usingRequired();
|
< 0.001 | 2 | 59 | for i = 1:numReq
|
< 0.001 | 2 | 60 | name = reqNames(i);
|
0.029 | 2 | 61 | func.(name) = varargin{i};
|
< 0.001 | 2 | 62 | supplied.(name) = true;
|
< 0.001 | 2 | 63 | end
|
| | 64 |
|
| | 65 | % get only the NV pairs
|
< 0.001 | 2 | 66 | params = varargin(numReq+1:end);
|
< 0.001 | 2 | 67 | if ~isempty(params)
|
< 0.001 | 1 | 68 | [params{1:2:end}] = convertStringsToChars(params{1:2:end});
|
| | 69 | % resolve partial matches
|
< 0.001 | 1 | 70 | results = parser.canonicalizeNames(params(1:2:end));
|
< 0.001 | 1 | 71 | params(1:2:end) = cellstr(results.CanonicalNames);
|
| | 72 | % get the argument struct
|
| 1 | 73 | else
|
< 0.001 | 1 | 74 | results = parser.canonicalizeNames({});
|
< 0.001 | 2 | 75 | end
|
0.005 | 2 | 76 | [paramStruct,additionalArgs] = parser.extractArgs(params{:});
|
| | 77 |
|
| | 78 | % assign parameter values to object
|
< 0.001 | 2 | 79 | paramnames = fieldnames(paramStruct);
|
< 0.001 | 2 | 80 | for i = 1:numel(paramnames)
|
< 0.001 | 1 | 81 | name = paramnames{i};
|
< 0.001 | 1 | 82 | func.(name) = paramStruct.(name); % validate by object setter
|
< 0.001 | 1 | 83 | supplied.(name) = true;
|
< 0.001 | 1 | 84 | end
|
< 0.001 | 2 | 85 | end
|
Other subfunctions in this file are not included in this listing.