1function options=ParseOptPara(options,Names,Types,Values,OptParas)
2% Script distributed with
"D. A. Bini, B. Meini, S. Steffe, B. Van Houdt:
3% Structured Markov chains solver: software tools"
5for i=1:2:size(OptParas,2)
7 if (i+1 <= size(OptParas,2))
9 arg=strmatch(prop,Names,
'exact');
10 if (isempty(arg)) % checks whether Invalid Property
11 warning(
'MATLAB:ParseOptPara:InvalidPropName',...
12 'Property name ''%s'' not recognized and ignored',prop);
14 if (eval([
'is' Types(arg,:)
'(value)'])) % checks whether property value
is of correct type
15 if (strmatch(
'char',Types(arg,:),
'exact')) % property values are strings
16 %if (isempty(strmatch(value,eval([prop
'Value']),
'exact')))
17 if (isempty(strmatch(value,Values{arg},
'exact')))
18 warning(
'MATLAB:ParseOptPara:InvalidPropValue',...
19 'Property value ''%s'' of ''%s'' not allowed and ignored',value,prop);
23 elseif (strmatch(
'numeric',Types(arg,:),
'exact')) % property values are numeric
26 else % incorrect
property value type
28 warning(
'MATLAB:ParseOptPara:InvalidPropType',...
29 'Property value ''%s'' of ''%s'' has an incorrect type and is ignored',value,prop);
33 warning(
'MATLAB:ParseOptPara:InvalidPropType',...
34 'Property value %d of ''%s'' has an incorrect type and is ignored',value,prop);
39 else % odd number of optional parameters
40 warning(
'MATLAB:ParseOptPara:OddNumbOptParas',...
41 'An odd number of optional parameters detected, last parameter ''%s'' ignored',prop);