Load binary data from XML file

Matthias Brennwald matthias at brennwald.org
Thu Jun 4 04:33:12 CDT 2009


Dear all

I'm trying to get some data in binary format from an XML file into 
Octave. I tried two approaches:

1. I tried xmlread that comes with Octave forge. This does not like my 
XML file, so I gave up.
 
2. I tried XML Tools from Matlab Central ( 
http://www.mathworks.ch/matlabcentral/fileexchange/1742 ) with its OCT 
file incarnation discussed at 
https://www-old.cae.wisc.edu/pipermail/octave-maintainers/2006-June/000277.html 
. This works nicely by doing the following in Octave:

fid=fopen('~/Desktop/F004.mzML');
s=char(fread(fid,[1,Inf],'char'));
fclose(fid);
list=xmlstruct(char(s));

Now 'list' is a struct containing the different XML elements, including 
the block of binary data stored in the XML file. However, the 
corresponding struct element in Octave is a string/char variable 
containing the hex code, which reflects my binary data. Here's the 
beginning of the hex code:

APDDxQCkA8YAzAPGAOCwxQBAtcUAbA7GAPDmxQC8GMYAGAjGAIwbxgAo/8UAaPbF...

This should correspond to a series of float numbers. How can I convert 
this string/char variable into numbers?

Matthias


More information about the Help-octave mailing list