LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW binary format that can be opened with Python

I need to save data in a binary format which can be opened with Python.  I have tried the "Write Waveforms to File (1D).vi" and can open them back up in LabView, but the binary format is not published anywhere, so I cannot open them in Python.  They appear to be saving as DataLog type binary files.

 

Is there another binary format which I can use that I can open in Python?

 

The reason I need this is that with 16-channel DAQ at 20kHz I can only save about 30 seconds of data.  For longer periods, the task of writing to a text file consumes all available memory and cpu.

0 Kudos
Message 1 of 4
(4,924 Views)

Did you try the Export Waveforms to Spreadsheet File as an alternative?

 

You can always crete your own format by simply using the Write Binary File. This will create a very compact file. You need to define your own header to indicate the number of channels and the timing information. Python can read binary files. There's an example that ships with LabVIEW on reading/writing binary files.

0 Kudos
Message 2 of 4
(4,895 Views)

I found a solution.  I found an open-source project called pyTDMS (google for it), and it can read tdms type files sometimes.  It was some trial and error to get my data saved in a way that pyTDMS could open the file, but in the end it works great.

 

I have two digital output channels as well as 16 analog input channels, so here is how I had to save the data within LabView:

 

The 16 analog input channels were saved as a 1D array of waveforms.  Then the digital output channels were made into another 1D array of waveforms.  The trick was to use the write tdms subvi twice.  Once for the analog input channels and again, on the same file, for the digital output channels.  pyTDMS opens these files just fine, and I can use the metadata to sort out what channels the data goes with in Python.

0 Kudos
Message 3 of 4
(4,887 Views)

Does pytdms can solve the following problem: Convert TDMS files in txt. Is it possible with pytdms? I lay in the Python language. Thank you.

0 Kudos
Message 4 of 4
(4,588 Views)