LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting all elements from array and array to spreadsheet string

Hello,

I would like to write a new data file for each "recording" session without closing the VI.  My problem is that the last "recording" session's data is at the top of every successive session's text file.  I do not want this.  I've tried to delete all rows from the array after my array to spreadsheet string function, but I think the problem is somewhere with the shift register and how the array is built.  I'm not too familiar with LabView and this aspect of my interface is driving me crazy.  Attached is my code and two successive data files.  I have not been able to find a solution on these or the LAVA forums.  Any help would be appreciated.

Also, I know there is an easier way to write this kind of streaming data, but I need to do it this way for other devices and synchronization purposes.
Download All
0 Kudos
Message 1 of 4
(2,793 Views)
You have an uninitialized feedback node that keeps another history that you cannot touch in your current code layout.
 
Why don't you use the data from the outer shift register to buit the array in frame 1 as follows:
 


Also the sequence structure in frame 2 has no purpose. Delete it!

Message Edited by altenbach on 07-03-2008 08:40 AM
0 Kudos
Message 2 of 4
(2,784 Views)
That is the best thing that has happened to me all week.  I was iffy on those feedback nodes and wired some things together and it worked (for data writing) but I clearly did not understand the science behind what I was doing.  I sincerely appreciate the help.
0 Kudos
Message 3 of 4
(2,776 Views)
A few more comments to your code:
 
Your loop does not have a wait, meaning it spins the empty case millions if times per second, consuming all CPU while not doing anything. Add an indicator to [i] to see.
 
To clear a 2D array in one case frame, just don't wire the output tunnel and set it to "use default if unwired". You'll get an empty array. No fancy tools needed.
 
I probably would use an event structure and also protect the data if the save dialog is canceled.
 
Here's a simple draft that probably requires a bit more work but should show some of the ideas.
 
 
You should also
  • add some protection that the VI cannot consume all available memory if it runs forever.
  • Create a seperate case to save the data later if the file dialog is cancelled the first time.
  • ...
 
0 Kudos
Message 4 of 4
(2,766 Views)