time | Calls | line |
---|
| | 37 | function checkAttrs( A, attrs, fname, msgId, argname, argpos )
|
| | 38 |
|
< 0.001 | 2 | 39 | warnOnUnknownAttr = true;
|
< 0.001 | 2 | 40 | numAttrs = length(attrs);
|
< 0.001 | 2 | 41 | idx = 1;
|
< 0.001 | 2 | 42 | isAttributeScalar = false;
|
| | 43 |
|
| | 44 | % isAttributeScalar is logical true when 'scalar' is one of the attributes
|
| | 45 | % provided by the user
|
| | 46 |
|
< 0.001 | 2 | 47 | for i=1:numAttrs
|
| | 48 |
|
< 0.001 | 2 | 49 | if isstring(attrs{i}) && ismissing(attrs{i})
|
| | 50 | error(message('MATLAB:validateattributes:missingValueInAttributeList'))
|
< 0.001 | 2 | 51 | elseif (ischar(attrs{i}) || isstring(attrs{i})) && strcmp(attrs{i},'scalar')
|
| | 52 | isAttributeScalar = true;
|
< 0.001 | 2 | 53 | end
|
< 0.001 | 2 | 54 | end
|
| | 55 |
|
< 0.001 | 2 | 56 | while idx <= numAttrs
|
< 0.001 | 2 | 57 | attr = attrs{idx};
|
| | 58 |
|
0.001 | 2 | 59 | attributor = findSupportedAttr( attr, isAttributeScalar);
|
< 0.001 | 2 | 60 | if isempty(attributor)
|
| | 61 | % only warn once if the attribute wasn't found in the supported list
|
| | 62 | if warnOnUnknownAttr
|
| | 63 | if ischar( attr ) || isstring( attr )
|
| | 64 | warning(message('MATLAB:validateattributes:attributeNotFound', char(attr) ))
|
| | 65 | else
|
| | 66 | warning(message('MATLAB:validateattributes:attributeBadClass', class(attr)))
|
| | 67 | end
|
| | 68 | warnOnUnknownAttr = false;
|
| | 69 | end
|
| | 70 | idx = idx + 1;
|
| | 71 | continue
|
< 0.001 | 2 | 72 | end
|
| | 73 |
|
< 0.001 | 2 | 74 | switch nargin( attributor )
|
< 0.001 | 2 | 75 | case 5
|
0.002 | 2 | 76 | attributor(A, fname, msgId, argname, argpos)
|
< 0.001 | 2 | 77 | idx = idx + 1;
|
| | 78 |
|
| | 79 | case 6
|
| | 80 | if idx == numel(attrs)
|
| | 81 | error(message('MATLAB:validateattributes:notEnoughArguments', attr))
|
| | 82 | end
|
| | 83 |
|
| | 84 | attributor(A, attrs{idx+1}, fname, msgId, argname, argpos )
|
| | 85 | idx = idx + 2;
|
| | 86 |
|
< 0.001 | 2 | 87 | end
|
| | 88 |
|
< 0.001 | 2 | 89 | end
|
| | 90 |
|
< 0.001 | 2 | 91 | end
|
Other subfunctions in this file are not included in this listing.