0001 function xml = xmladd(ps, xml, nodename, node)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 el = xml.docNode.createElement(nodename);
0012
0013 for j=1:length(ps)
0014 p = ps(j);
0015
0016 elc = xml.docNode.createElement('param');
0017
0018
0019 elcc = xml.docNode.createElement('name');
0020 elcc.appendChild(xml.docNode.createTextNode(p.name));
0021 elc.appendChild(elcc);
0022
0023
0024 xml = xmladd(p.created, xml, 'created', elc);
0025
0026
0027 elcc = xml.docNode.createElement('version');
0028 elcc.appendChild(xml.docNode.createTextNode(p.version));
0029 elc.appendChild(elcc);
0030
0031
0032 elcc = xml.docNode.createElement('key');
0033 elcc.appendChild(xml.docNode.createTextNode(p.key));
0034 elc.appendChild(elcc);
0035
0036
0037 if ischar(p.val)
0038 elcc = xml.docNode.createElement('value');
0039 elcc.appendChild(xml.docNode.createTextNode(p.val));
0040 elc.appendChild(elcc);
0041
0042
0043 elseif isnumeric(p.val)
0044 elcc = xml.docNode.createElement('value');
0045 elcc.appendChild(xml.docNode.createTextNode(ltpda_mat2str(p.val)));
0046 elc.appendChild(elcc);
0047
0048
0049 elseif iscell(p.val)
0050 if isempty(p.val)
0051 elcc = xml.docNode.createElement('value');
0052 elcc.appendChild(xml.docNode.createTextNode(''));
0053 elc.appendChild(elcc);
0054 else
0055 if ischar(p.val{1})
0056 elcc = xml.docNode.createElement('value');
0057 str = 'CELL:';
0058 for jj=1:length(p.val)
0059 str = [str ' ' p.val{jj}];
0060 end
0061 elcc.appendChild(xml.docNode.createTextNode(str));
0062 elc.appendChild(elcc);
0063 else
0064 error('### The value of a parameter can only contain a cell array of character');
0065 end
0066 end
0067
0068 else
0069 xml = xmladd(p.val, xml, 'value', elc);
0070 end
0071
0072 el.appendChild(elc);
0073 end
0074
0075 node.appendChild(el);
0076
0077
0078
0079