Encodexml: Difference between revisions
Jump to navigation
Jump to search
imported>Jeremy (Importing text file) |
imported>Jeremy (Importing text file) |
||
Line 7: | Line 7: | ||
:xml = encodexml(var) | :xml = encodexml(var) | ||
:xml = encodexml(var,'name') | :xml = encodexml(var,'name') | ||
:xml = encodexml(var,'name','outputfile.xml') | :xml = encodexml(var,'name','outputfile.xml') | ||
Revision as of 16:33, 3 September 2008
Purpose
Convert standard data types into XML-encoded text.
Synopsis
- xml = encodexml(var)
- xml = encodexml(var,'name')
- xml = encodexml(var,'name','outputfile.xml')
Description
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.
Example
>> z.a = 1;
>> z.b = { 'this' ; 'that' };
>> z.c.sub1 = 'one field';
>> z.c.sub2 = 'second field';
>> z = encodexml(z,'mystruct')
z =
<mystruct>
<a class="numeric" size="[1,1]">1</a>
this that <c> <sub1 class="string">one field</sub1> <sub2 class="string">second field</sub2> </c> </mystruct>