0001 function data = xml_read_datasamples(node, dType)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 switch dType
0016 case 'real'
0017
0018 disp('-- reading real data samples');
0019
0020 data.x = [];
0021 data.y = [];
0022
0023 children = node.getChildNodes;
0024 for j=1:children.getLength
0025 ch = children.item(j-1);
0026 nodeName = char(ch.getNodeName);
0027
0028 switch nodeName
0029 case 'XSet'
0030 vals = str2num(char(ch.getTextContent));
0031 data.x = [data.x ; vals];
0032 disp(['* read ' num2str(length(data.x)) ' X samples']);
0033 case 'YSet'
0034 vals = str2num(char(ch.getTextContent));
0035 data.y = [data.y ; vals];
0036 disp(['* read ' num2str(length(data.y)) ' Y samples']);
0037 otherwise
0038
0039 end
0040 end
0041
0042
0043
0044
0045 case 'complex'
0046
0047 disp('-- reading complex data samples');
0048
0049 data.x = [];
0050 ry = [];
0051 iy = [];
0052
0053 children = node.getChildNodes;
0054 for j=1:children.getLength
0055 ch = children.item(j-1);
0056 nodeName = char(ch.getNodeName);
0057
0058 switch nodeName
0059 case 'XSet'
0060 vals = str2num(char(ch.getTextContent));
0061 data.x = [data.x vals];
0062 disp(['* read ' num2str(length(data.x)) ' X samples']);
0063 case 'rYSet'
0064 vals = str2num(char(ch.getTextContent));
0065 ry = [ry vals];
0066 disp(['* read ' num2str(length(ry)) ' real Y samples']);
0067 case 'iYSet'
0068 vals = str2num(char(ch.getTextContent));
0069 iy = [iy vals];
0070 disp(['* read ' num2str(length(iy)) ' imag Y samples']);
0071 otherwise
0072
0073 end
0074 end
0075
0076
0077
0078
0079
0080 data.y = complex(ry, iy);
0081
0082 otherwise
0083 error('### unknown data type.');
0084 end
0085
0086
0087
0088