File Exchange

image thumbnail

National Instruments (NI) XML reader for Matlab

version 1.0 (4.72 KB) by

Two functions: one for printing and one for reading into a struct an National Instruments XML file

0 Downloads

Updated

View License

Requires Matlab's xmlread.m function
read_ni_xml_object.m
print_ni_xml_object.m
example.xml

Comments and Ratings (2)

Ian

Ian (view profile)

This is still a great submission, but I have found a bug either in the script or in LabVIEW 2009's XML implementation. If I create an XML file in LV containing only an array, usually I get a block that looks like this:

<Array>
<Name>Decimated Array</Name>
<Dimsize>800</Dimsize>
<DBL>
<Name></Name>
<Val>20.03500875218805</Val>
</DBL>
<DBL>
<Name></Name>
<Val>20.12253063265817</Val>
</DBL>
</Array>

But sometimes I get this instead:

<Array>
<Name>Decimated Array</Name>
<Dimsize>800</Dimsize>
<DBL>
<Name>Numeric</Name>
<Val>20.03500875218805</Val>
</DBL>
<DBL>
<Name>Numeric</Name>
<Val>20.12253063265817</Val>
</DBL>
</Array>

and when the script comes across the word 'Numeric', it thinks that it's no longer an array and over-writes the previous value.

In my copy, I've modified line 86 to read:

if isempty(name) || strcmp(name,'Numeric')

Since I'm new to using the XML file format with LV, I don't know how general this fix is going to be.

I still stand by my 5 stars, though.

Ian

Ian (view profile)

Works great with LabVIEW 2009. This just saved me so much time and headache.

MATLAB Release
MATLAB 7.13 (R2011b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video