LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fast write to file

I am using a PXI chassis (real time) to acquire data from various channels (7 differential analog channels). I am also using labview version 8.6. I would like to be able to write all of these channels to file at a very fast sample rate. If I try to write to file faster than 1 sample per second, it slows down the entire program. The chassis just can't keep up. Is there a way to write to a variable, and then write to file once the data acquisistion is done? Is there a way to write all of this data to file rather quickly? I would like to be able to acquire data at a sample rate of 1000 samples per second. Any help would be greatly appreciated.

0 Kudos
Message 1 of 5
(3,278 Views)

How are you saving the data to disk?

 

I'm not sure if it is available in RT, but DAQmx (starting with version 9) has a Stream to TDMS function to automatically send your DAQ data to a TDMS file.  This can help a lot.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(3,272 Views)

I am using a write to spreadsheet vi. I am using a build array just before the write to file vi to gather 11 different signals to send to the write to file. I have tried inserting a copy of my code, but it isn't working for some reason. We typically just save the file as a text (.txt) file.

 

 

 

0 Kudos
Message 3 of 5
(3,262 Views)

There could be a lot of issues going on here.  Are you writing your spreadsheet values in the same loop as your DAQ?  If so this is why you are slowing down yoru DAQ.  Also, from what i understand writing a TDMS file is much faster than spreadsheet b/c its a binary format.  I would recommend switching to TDMS.  There is an addon for excel that allows you to import these files directly into excel.  If you have to have a delimated spreadsheet file, you could write to TDMS and then write your spreadsheet after all your sampling is complete by reading the TDMS and converting the data into spreadsheet format.  

0 Kudos
Message 4 of 5
(3,252 Views)

@bobsmack wrote:

I am using a write to spreadsheet vi. 


Well, this is definitely not a high performance option, because write to spreasheet file needs to do quite a few expensive operations for each call (1) open the file, (2) format the data in human readable form, (2) close the file).

 

You will be orders of magnitude faster if you open the file once before the loop and append raw binary data with each write, then close the file after the loop has finished. Try it!

0 Kudos
Message 5 of 5
(3,245 Views)