LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Save to Spread Sheet file every N samples

I am in the need for a way to automatically save data to a file for every N-samples that are acquired.  I've written the attatched reentrant subVI, but there are some problems.  Whenever I have it in my program loop it hogs the process (stalling data acquisition) and just writes the initial values a bunch of times (the file quickly goes into the 10's of megs).  I don't know where I'm going wrong in my algorithm.

Here is the algorithm I'm trying to realize with this subvi.

Inputs:
1. 1 x M array
2. number of samples to record at a time (N)
3. path to folder to automatically save files

Algorithm:
Initial run:
1. Create file name based on current date/time and folder path input.
2. Initialize an array that is N x M (so the number of rows is the number of samples to record, by the number of columns coming from the input).
3. Place the first row of input data into the first column of the array.

Subsequent runs:
1. Place the input data into the next position of the N x M array
2. If and only if current_input_count % N == (N - 1) then save the data to the autosave file.  (note: %=modulus operator)

My typical sample rate is around 2-5 samples per second.  I need this because some of our tests are really long (like hours long), and if the DAQ computer fails to save the final data set then we pretty much lost the entire test.

Sorry my G code is so sloppy.  Thank you for any input.  I'm targetting LabVIEW 8.

-Nickerbocker
0 Kudos
Message 1 of 4
(3,234 Views)
For "automatically saving the data to a file for every N-samples that are acquired", you might have to use LabVIEW measurement file for storing your samples. Also, I have slightly modified your code. Double click on the LabVIEW Measurement file and then check different options available to store your samples. Hope this helps.
 
PS: Assuming that this is the only probelm you have, I didn't go through your algorithm.
0 Kudos
Message 2 of 4
(3,225 Views)
Thank you for the reply.  Let me see how this works with our setup.  I'm comming from LabVIEW 5 and haven't taken the time to learn about this "measurement file" stuff.  I'll have to play around with it.  My only concern is I need the file to be in binary or text spreadsheet format in order to read the file in MathCAD where I do most of my analysis.
0 Kudos
Message 3 of 4
(3,213 Views)
The Write LabVIEW Measurement File outputs a text file. It is similar to the Write to Spreadsheet File but it adds quite a bit of header information. If you want to write simple text, then the Write to Spreadsheet File or Write Characters to File will work. If you want to write binary, you can certainly do that as well with the advantage of creating smaller files and writing faster.
0 Kudos
Message 4 of 4
(3,203 Views)