0001 function po = fromxml(xml)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 p.name = '';
0017 p.poles = [];
0018 p.zeros = [];
0019 p.gain = 0;
0020
0021 sch = xml.getChildNodes;
0022 for c=1:sch.getLength
0023 x = sch.item(c-1);
0024 switch char(x.getNodeName)
0025 case 'name'
0026 p.name = char(x.getTextContent);
0027 case 'gain'
0028 p.gain = str2num(char(x.getTextContent));
0029 case 'poles'
0030 p.poles = [];
0031 xch = x.getChildNodes;
0032 for j=1:xch.getLength
0033 it = xch.item(j-1);
0034 if strcmp(char(it.getNodeName), 'pole')
0035 p.poles = [p.poles pole(it)];
0036 end
0037 end
0038 case 'zeros'
0039 p.zeros = [];
0040 xch = x.getChildNodes;
0041 for j=1:xch.getLength
0042 it = xch.item(j-1);
0043 if strcmp(char(it.getNodeName), 'zero')
0044 p.zeros = [p.zeros zero(it)];
0045 end
0046 end
0047 otherwise
0048 end
0049 end
0050
0051
0052 po = pzmodel(p.gain, p.poles, p.zeros, p.name);
0053
0054