LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading Labview XML schema files in python(or matlab)

Solved!
Go to solution

Hi,

 

Anyone have any experience loading labview xml schema into python or matlab or similiar?  Or is there a better format to output into that might have an easier interface.  I guess I want to be able to use the labview frontend i have as much as possible but to do any other processing elsewhere.  Was vaguely hoping that there might be a simple conversion or imput schema i can use - without having to maintain several different sets of input\output code on different systems - any thoughts?

 

JP

0 Kudos
Message 1 of 6
(4,293 Views)

Hi JP,

 

I was wondering if you could give me a little more information about what you're trying to do.

 

Is your LabVIEW code writing data to a .xml file? What kind of data?

 

What do you want to be able to read in python, the data or the XML code or the schema?

 

Thanks and Kind Regards,

Joel G
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 2 of 6
(4,261 Views)

Hi,

 

Thanks for the reply. 

 

I guess the point is at the moment I have various frontends that output data into text files in various formats - partially because of convience and partially because I had legacy code.  I like to do my data analysis in scripting languages on this data - since it's a bit easier to automate + output print quality graphs. 

 

I have found it easier recently to input and output previous data taken in labview using the XML schema - since then I can just dump it in and out without having to spend ages formatting things into text and back (*Although i have to say for large arrays the xml schema is pretty wasteful.)  This is good when i'm just doing stuff in labview - although it then causes a problem inputing the data into a scripting language.

 

I guess I was (lazily) wondering if anybody had solved these sorts of problems before.  I guess I could imagine it being possible to write something that recognises the labview schema and creates a data collection in one or other of these languages.

 

JP

 

 

0 Kudos
Message 3 of 6
(4,238 Views)

Hi JP,

 

Sorry for the delayed reply, I see what you're after now. I've been having a look around for the kind of script you're after and can't find anything, hopefully someone will see this and have done it before. I did find this link:

 

http://zone.ni.com/reference/en-XX/help/371361E-01/lvhowto/labview_xml_schema/

 

So it looks like it might be difficult to do in LabVIEW! But perhaps you could write something in python to import your data.

 

Maybe one of the links on this forum page could help you.

 

http://lavag.org/topic/6655-labview-xml-and-other-xml-schemas/

 

I'm wondering if the LabVIEW Schema format is documented anywhere but haven't found anything yet.

 

Kind regards,

Joel G
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 4 of 6
(4,216 Views)
Solution
Accepted by topic author wideofthemark

Thanks,

 

So I guess if you want something doing ....

 

I have put together something that helps parsing the XML into python.  I have to say i haven't tested it much but it seems to do the simple things that i need ok for the moment. I've attached it in case it might be useful for someone else.

 

Basically the two files that you need are LabviewXMLDataLoader.py, and ContextDict.py - the first is the module that parses the xml, the second is a module that i stole from elsewhere, and mangled so that its easier to have nested 'dicitionaries' which i guess are the closest in python to clusters in LV.

 

PulsedMeasurement_v2.py is an example of how i'm loading the variables of a lv object into a python object.

 

Anyway, like i said it isn't perfect, but its a starting point.

 

 

0 Kudos
Message 5 of 6
(4,208 Views)

Incidentally it would make a lot of sense in whatever the next version of labview to be able to pass custom schema to Labview->XML.

 

JP

Message 6 of 6
(4,181 Views)