No BSD License  

Highlights from
XML4MAT v2.0

5.0

5.0 | 5 ratings Rate this file 27 Downloads (last 30 days) File Size: 234.51 KB File ID: #6268
image thumbnail

XML4MAT v2.0

by Jonas Almeida

 

12 Nov 2004 (Updated 16 Nov 2004)

Converts XML to and from MATLAB structured variables.

| Watch this File

File Information
Description

Inter-conversion between MATLAB structured variables and XML strings. A markup language was defined to support string representation of any MATLAB variable. Additional m-functions support import of any XML structure. The final picture: any XML --> MbML <--> MATLAB.

Manuscript describing original (v1.0) of tbox was published at:

Almeida, J.S., Wu, S., and Voit, E.O. (2003) XML4MAT: Inter-conversion between MatlabTM structured variables and the markup language MbML. Computer Science Preprint Archive (Elsevier), 2003(12):9-17.

Acknowledgements
This submission has inspired the following:
SHORTSTOOL: Browse through User Shortcut Toolbar
MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
11 Jun 2005 lyhwus lywhus

Very good sofware and is open source

15 Dec 2006 Jaakko R

Just works for me.

10 Apr 2010 Kevin

Very nice job. Impressive, elegant design. Love the open source too.

One thing I had to do right away was add a large precision to the num2str function in mat2xml. I was dealing with large values and needed the precision to remain. Line 35:
    XML=[XML,num2str(MAT(:)',100)];

05 Apr 2011 Charles Garfinkle

Sorry, between lines 25 and 26, not 26 and 27.

05 Apr 2011 Charles Garfinkle

Fantastic. The only edit I needed to make was to have mbmling.m also remove horizontal tabs between elements by adding the following between lines 25 and 26:

xml=strrep(xml,sprintf(['>',char(9)]),'>');

Otherwise, the presence of tabs between elements of the XML file caused xml2struct.m to throw an error and xml2cell.m to create cells containing structures that combine child elements with the parent element's last attribute (rather than creating separate cells for each child and parent attribute).

11 Apr 2011 Charles Garfinkle

Also, opening a matlabpool and having some of the for loops in xml2mat.m done in parallel (parfor) results in a significant increase in speed for large trees.

13 Jan 2012 Mirko

Hi, I've some problem with a file like this: any Suggestions?
The result struct is not the same as the one I expected. Ok for duplication of fields/substruct when I've the same tag (<value> in this case). But something missing, i.e. sourcefileselectedcodes is not stored in result struct.

<?xml version="1.0" ?>
<!--
Put here comments
-->

<runselectiondisplayinfo>
<sourcefilenameselected>
<typeCode>7</typeCode>
<numberOfElements>6</numberOfElements>
<value>psa_blacksea_NA__mld_2002_05.nc</value>
<value>psa_blacksea_NA__mld_2002_06.nc</value>
<value>psa_blacksea_NA__mld_2002_07.nc</value>
<value>psa_blacksea_NA__mld_2003_05.nc</value>
<value>psa_blacksea_NA__mld_2003_06.nc</value>
<value>psa_blacksea_NA__mld_2003_07.nc</value>
</sourcefilenameselected>
<sourcefileselectedcodes>
<typeCode>7</typeCode>
<numberOfElements>6</numberOfElements>
<value>184</value>
<value>172</value>
<value>173</value>
<value>174</value>
<value>185</value>
<value>186</value>
</sourcefileselectedcodes>
<roicodesselected>
<typeCode>7</typeCode>
<numberOfElements>1</numberOfElements>
<value>blacksea</value>
</roicodesselected>
<yearcodesselected>
<typeCode>7</typeCode>
<numberOfElements>2</numberOfElements>
<value>2002</value>
<value>2003</value>
</yearcodesselected>
<resolutioncodesselected>
<typeCode>7</typeCode>
<numberOfElements>4</numberOfElements>
<value>20x20</value>
<value>2x2</value>
<value>5x5</value>
<value>N/A</value>
</resolutioncodesselected>
<monthcodesselected>
<typeCode>7</typeCode>
<numberOfElements>3</numberOfElements>
<value>05</value>
<value>06</value>
<value>07</value>
</monthcodesselected>
<runcodeselected>
<typeCode>2</typeCode>
<value>1</value>
</runcodeselected>
<removesourcefilesflag>
<typeCode>1</typeCode>
<value>0</value>
</removesourcefilesflag>
<allsourcefilesflag>
<typeCode>1</typeCode>
<value>1</value>
</allsourcefilesflag>
<allroiflag>
<typeCode>1</typeCode>
<value>0</value>
</allroiflag>
<allresolutionflag>
<typeCode>1</typeCode>
<value>0</value>
</allresolutionflag>
<allyearflag>
<typeCode>1</typeCode>
<value>0</value>
</allyearflag>
<allmonthflag>
<typeCode>1</typeCode>
<value>0</value>
</allmonthflag>
<classname>
<typeCode>7</typeCode>
<value>RUNSELECTIONDISPLAYINFO</value>
</classname>
</runselectiondisplayinfo>

Thank you.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
structures Jonas Almeida 22 Oct 2008 07:35:41
cell arrays Jonas Almeida 22 Oct 2008 07:35:41
xml4mat Jonas Almeida 22 Oct 2008 07:35:41
xml Jonas Almeida 22 Oct 2008 07:35:41
utilities Jonas Almeida 22 Oct 2008 07:35:41
converter Jonas Almeida 22 Oct 2008 07:35:41
converter Christoph 20 Sep 2010 05:35:34
xml Nicholas 13 Jan 2012 22:19:40
xml David 11 May 2012 16:04:56

Contact us at files@mathworks.com