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