<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Labview on shocksolution.com</title><link>https://shocksolution.com/tags/labview/</link><description>Recent content in Labview on shocksolution.com</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 25 Jun 2008 16:04:46 +0000</lastBuildDate><atom:link href="https://shocksolution.com/tags/labview/index.xml" rel="self" type="application/rss+xml"/><item><title>Reading Labview binary files with Python</title><link>https://shocksolution.com/posts/reading-labview-binary-files-with-python/</link><pubDate>Wed, 25 Jun 2008 16:04:46 +0000</pubDate><guid>https://shocksolution.com/posts/reading-labview-binary-files-with-python/</guid><description>&lt;p&gt;My research group uses Labview 7.1 to write custom data acquisition (DAQ) software. I code everything else in Python, so I need to get data from Labview into Python for processing. Our DAQ program produces Labview binary files, so I had to find a way to read them with Python. Binary files are nice because they are a compact way to store numerical data as compared to ASCI or (heaven forbid) XML, but they are much harder to read. The binary format used by Labview is documented only indirectly, so I had to hack a little. The first thing to realize is that the Labview binary file is a direct dump of the data that was stored in RAM. &lt;a href="http://zone.ni.com/reference/en-XX/help/371361A-01/lvconcepts/how_labview_stores_data_in_memory/" title="How%20Labview%20stores%20data%20in%20RAM"&gt;How Labview stores data in memory is documented here.&lt;/a&gt; Indirectly, this documents how binary files are stored on disk. Our DAQ program writes a rather complex &amp;ldquo;cluster&amp;rdquo; (Labview&amp;rsquo;s version of a C structure) to disk. The elements of the cluster are stored contiguously as a sequence of bytes, and there&amp;rsquo;s no way to know which byte goes with which element, unless you know the size of each element and the order in which they are stored in the cluster. So, the first step is to document the cluster that&amp;rsquo;s being written to disk. You can use the context help in Labview to view the data type of the wire that leads to the VI that writes the file. With this in hand, you are ready to write Python code. First, make sure you open the file in binary mode:&lt;/p&gt;</description></item></channel></rss>