Search code examples
filevilabview

LabVIEW 2009 holding onto data when I don't want it to


I'm new to LabVIEW but have been building a signal analyser code that takes the required data and prints it out to text files after the data has been taken. The problem I'm having is that when it makes a new file it holds on to the data from the previous run and prints that too which is not what I want. I've attached the LabVIEW vi (ver.2009), and any help with this would be greatly appreciated.

Also if someone knows a better way of RMS-ing the data after each iteration than my mess of shift registers I'd be happy to see it.

frequency analyser (fixed).vi


Solution

  • To answer your main question: the part of the code that builds the string (for loop with a shift register) stores the previous data each time you re-run the vi. What you need is to initialise the shift register with an empty string :

    vi

    Also a couple of notes/suggestions:

    • You could avoid using shift registers in this case. Divide the DAQ part of the code into say 3 parts: acquire data in the first for loop (store into array), modify the array (you could then perhaps use the build-in RMS vi), visualise on the UI
    • Build the code in smaller chunks, use subVi's
    • Keep the code small, nice and tidy (check coding standards), add comments - this will really help you later