Load binary data from XML file
Martin Weiser
weiser2 at natur.cuni.cz
Thu Jun 4 06:11:06 CDT 2009
On Thu, 4 Jun 2009, Matthias Brennwald wrote:
> 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
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
>
Hello,
just a wild guess: try to find the character that separates them (xQ ?),
separate them (see string manipulating functions in the manual) and use
octave function hex2dec
HTH.
Martin
More information about the Help-octave
mailing list