Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Limiting file size in Cont Acq&Graph Voltage-To File(Binary).vi

If I run my modified version of Cont Acq&Graph Voltage-To File(Binary).vi for several hours I will have one very big file. How can I make it save my data every 30 seconds to files with incremented file names?

Thanks
0 Kudos
Message 1 of 6
(3,550 Views)

Hi hellolv,

The easiest way to write to multiple binary files and have header data is to use the Write to Measurement File VI which can be found in the File I/O palette. This Express VI can automatically create a series of files. To do this, select Save to a series of files (multiple files) in the configuration window. You can edit how these new files will be created by clicking on the Settings… button. This will bring up a new window where you can configure the naming convention, set the replacement property, and determine when a new file will be created.

If you would like to avoid expensive file creation and destruction operations every time you’re ready to write to file, you can perform some string manipulation on the file path to rename the file and use a For Loop along with a timing element (or your sample rate) to control the duration each file that will be written to. The total duration will be the input to the For Loop’s N (in this case 5) multiplied by the input to Wait Until Next ms Multiple, or your For Loop’s N multiplied by your sample rate divided by your number of samples, whichever is longer. The image below shows the block diagram of a modified version of Cont Acq&Graph Voltage-To File(Binary).vi. That VI is also attached to this post.

Message Edited by ryan_d on 10-05-2007 03:01 PM

Ryan D.
District Sales Manager for Boston & Northern New England
National Instruments
Download All
0 Kudos
Message 2 of 6
(3,529 Views)
Thanks Ryan. I think I am going to try the loop method since this is for 64 channels of data and I need all the free resources I can muster.
0 Kudos
Message 3 of 6
(3,526 Views)
Ryan,

When I run what you posted I get

Error -200429 occurred at DAQmx Read (Analog 2D I32 NChan NSamp).vi:1

Possible reason(s):

Measurements: Value passed to the Task/Channels In control is an empty string (or I/O control).

The value must refer to a valid task or valid channels



I have tried many different ways to get my vi to save multiple files with incremented file names and my custom header and I just cannot get it to work. 

Can any one help?
0 Kudos
Message 4 of 6
(3,466 Views)
There is a big difference between the image and the posted VI. The DAQmx Clear task should be outside the loop. The image is correct.
0 Kudos
Message 5 of 6
(3,464 Views)
Thanks Dennis. My mistake! I must have posted an in-work version. Please find the corrected VI attached.
Ryan D.
District Sales Manager for Boston & Northern New England
National Instruments
0 Kudos
Message 6 of 6
(3,442 Views)