From Eigenvector Research Documentation Wiki
Revision as of 11:13, 7 July 2015 by imported>Jeremy (Description)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Convert standard data types into XML-encoded text.


xml = encodexml(var)
xml = encodexml(var,'name')
xml = encodexml(var,'name','outputfile.xml')


Converts a standard MATLAB variable (var) into a human-readable XML format. The optional second input ('name') gives the name for the object's outer wrapper and the optional third input ('filename.xml') gives the name for the output file (if omitted, the XML is only returned in the output variable). For more information on the format, see the parsexml function.


  • var = variable to be converted to XML format

Optional Inputs

  • 'name' = name for object's outer wrapper.
  • 'outputfile.xml' = output file (if omitted, XML code is returned to the output variable only).


  • xml = string containing XML formatted code to reconstruct tt.


>> z.a = 1;
>> z.b = { 'this' ; 'that' };
>> z.c.sub1 = 'one field';
>> z.c.sub2 = 'second field';
>> z = encodexml(z,'mystruct')
z =
  <a class="numeric" size="[1,1]">1</a>
  <b class="cell" size="[2,1]">
      <td class="string">this</td>
      <td class="string">that</td>
    <sub1 class="string">one field</sub1>
    <sub2 class="string">second field</sub2>

See Also

autoexport, encode, parsexml, encodemodelbuilder