0001 function xml = xmladd(ds, xml, nodename, node)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 el = xml.docNode.createElement(nodename);
0012
0013 for j=1:length(ds)
0014
0015 d = ds(j);
0016
0017 elc = xml.docNode.createElement('xydata');
0018
0019
0020 elcc = xml.docNode.createElement('name');
0021 elcc.appendChild(xml.docNode.createTextNode(d.name));
0022 elc.appendChild(elcc);
0023
0024
0025 elcc = xml.docNode.createElement('xunits');
0026 elcc.appendChild(xml.docNode.createTextNode(d.xunits));
0027 elc.appendChild(elcc);
0028
0029
0030 elcc = xml.docNode.createElement('yunits');
0031 elcc.appendChild(xml.docNode.createTextNode(d.yunits));
0032 elc.appendChild(elcc);
0033
0034
0035 elcc = xml.docNode.createElement('version');
0036 elcc.appendChild(xml.docNode.createTextNode(d.version));
0037 elc.appendChild(elcc);
0038
0039
0040 xml = xmladd(get(d, 'created'), xml, 'created', elc);
0041
0042 if isreal(d.y)
0043
0044 elcc = xml.docNode.createElement('dtype');
0045 elcc.appendChild(xml.docNode.createTextNode('real'));
0046 elc.appendChild(elcc);
0047
0048
0049 elcc = xml.docNode.createElement('data');
0050 x = d.x;
0051 nmin = getappdata(0, 'xmlsetsize');
0052 while ~isempty(x)
0053 elccc = xml.docNode.createElement('xset');
0054 n = min(length(x), nmin);
0055 elccc.appendChild(xml.docNode.createTextNode(ltpda_mat2str(x(1:n))));
0056 x = x(n+1:end);
0057 elcc.appendChild(elccc);
0058 end
0059
0060 y = d.y;
0061 nmin = getappdata(0, 'xmlsetsize');
0062 while ~isempty(y)
0063 elccc = xml.docNode.createElement('yset');
0064 n = min(length(y), nmin);
0065 elccc.appendChild(xml.docNode.createTextNode(ltpda_mat2str(y(1:n))));
0066 y = y(n+1:end);
0067 elcc.appendChild(elccc);
0068 end
0069 elc.appendChild(elcc);
0070 else
0071
0072 elcc = xml.docNode.createElement('dtype');
0073 elcc.appendChild(xml.docNode.createTextNode('complex'));
0074 elc.appendChild(elcc);
0075
0076
0077 elcc = xml.docNode.createElement('data');
0078 y = d.y;
0079 nmin = getappdata(0, 'xmlsetsize');
0080 while ~isempty(y)
0081 n = min(length(y), nmin);
0082 elccc = xml.docNode.createElement('ryset');
0083 elccc.appendChild(xml.docNode.createTextNode(ltpda_mat2str(real(y(1:n)))));
0084 elcc.appendChild(elccc);
0085 elccc = xml.docNode.createElement('iyset');
0086 elccc.appendChild(xml.docNode.createTextNode(ltpda_mat2str(imag(y(1:n)))));
0087 elcc.appendChild(elccc);
0088 y = y(n+1:end);
0089 end
0090
0091 x = d.x;
0092 nmin = getappdata(0, 'xmlsetsize');
0093 while ~isempty(x)
0094 elccc = xml.docNode.createElement('xset');
0095 n = min(length(x), nmin);
0096 elccc.appendChild(xml.docNode.createTextNode(ltpda_mat2str(x(1:n))));
0097 x = x(n+1:end);
0098 elcc.appendChild(elccc);
0099 end
0100 elc.appendChild(elcc);
0101 end
0102
0103 el.appendChild(elc);
0104 end
0105
0106 node.appendChild(el);
0107
0108
0109