LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Losing data when saving it to a File?

Solved!
Go to solution

Hello,

 

I'm having problems with saving my data. I acquire it at 2.5MHz for 5 seconds and when I visualize it I can only see 1,2s of data, if using only one channel, or less than that, like 0,4s of data, when getting 8 channels.

My vi is attached and also a picture of it. To analyze it I'm using "TDMS File Viewer" (TDMS - File Viewer.vi):

Attached is also a picture of the File Viewer. Check the number of samples (225000) and the time in which it was taken (11/19/2008 16:14:30.423) and (11/19/2008 16:14:31.362). With a 2.5MHz, there should be lot more samples than what is there...  The last sample (not showed on the picture) is from time (11/19/2008 16:14:30.513), only 0,1s after starting to acquire data.

 

Is the problem with the queue? If not, why is data not being recorded?

 

Thanks for the help,

Rafael

 

Download All
0 Kudos
Message 1 of 6
(3,261 Views)
Solution
Accepted by topic author Danigno
Your consumer (lower)) thread will be scuttled as soon the producer (upper) thread exits. Exiting the top loop kills the queue; dequeue element will return an error, and write to file won't do anything if there is an error on input. So any elements remaining in the queue when it was killed are lost. The easiest way to fix this is to add another loop to the upper thread; after your existing while loop quits, loop with a short (10 msec) delay until the queue is empty (per Get Queue Status). Kill the queue only after all of your results have been written to disk.
Message 2 of 6
(3,242 Views)

Thanks for the sugestion Rob, I'll try that now...,

Rafael

0 Kudos
Message 3 of 6
(3,208 Views)

It worked man! Thanks a lot!! 🙂

0 Kudos
Message 4 of 6
(3,205 Views)

hey Rob

 

from what i can see from the forums, you're really good at labview. I need a hand with my program. I have a program that records audio from microphone and then creates a wav file and saves it in it except that my file size increases and the program doesn't stop and when I stop it manually and try to play the file saved..it doesn't have anything in it. just a wav file that likes 20mb. I don't know why.

 

Thanks a lot

0 Kudos
Message 5 of 6
(3,092 Views)

Hi Oli,

 

first: you should create new threads instead of hijacking older (more or less) unrelated threads.

2nd: you should provide information oin what you have achieved so far, i.e. attach your vi or atleast a pic of it!

 

After doing so we will have a chance to provide more detailed help...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 6
(3,075 Views)