1function options=Q_ParseOptPara(options,Names,Types,Values,OptParas)
3for i=1:2:size(OptParas,2)
5 if (i+1 <= size(OptParas,2))
7 arg=strmatch(prop,Names,
'exact');
8 if (isempty(arg)) % checks whether Invalid Property
9 warning(
'MATLAB:Q_ParseOptPara:InvalidPropName',...
10 'Property name ''%s'' not recognized and ignored',prop);
12 if (eval([
'is' Types(arg,:)
'(value)'])) % checks whether property value
is of correct type
13 if (strmatch(
'char',Types(arg,:),
'exact')) % property values are strings
14 %if (isempty(strmatch(value,eval([prop
'Value']),
'exact')))
15 if (isempty(strmatch(value,Values{arg},
'exact')))
16 warning(
'MATLAB:Q_ParseOptPara:InvalidPropValue',...
17 'Property value ''%s'' of ''%s'' not allowed and ignored',value,prop);
21 elseif (strmatch(
'numeric',Types(arg,:),
'exact')) % property values are numeric
23 elseif (strmatch(
'cell',Types(arg,:),
'exact')) % property values are cell
26 else % incorrect
property value type
28 warning(
'MATLAB:Q_ParseOptPara:InvalidPropType',...
29 'Property value ''%s'' of ''%s'' has an incorrect type and is ignored',value,prop);
32 warning(
'MATLAB:Q_ParseOptPara:InvalidPropType',...
33 'Property value ''%s'' of ''%s'' has an incorrect type and is ignored',value,prop);
36 warning(
'MATLAB:Q_ParseOptPara:InvalidPropType',...
37 'Property value %d of ''%s'' has an incorrect type and is ignored',value,prop);
41 else % odd number of optional parameters
42 warning(
'MATLAB:Q_ParseOptPara:OddNumbOptParas',...
43 'An odd number of optional parameters detected, last parameter ''%s'' ignored',prop);