LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Removing 0 values on a dataset that has been subsampled

I am collecting pressure data at a rate of 1 Hz and writing it to a file for future analysis.  The tests I am running take several days to run, so even at a rate of 1 Hz the data files get quite large fairly quickly.  Therefore, I am subsampling the data at a rate of 1 point per minute (using Resample Waveform vi).  With this smaller dataset I am both plotting it in real time (waveform plot) and writing a second file to disk.  My problem is that the smaller file isn't turning out to be any smaller because zero-values are being written to the file for 59 seconds.  What I need is for nothing to be written to the file during this span and only have data written to the file when it is subsampled.  I am a Labview neophyte and therefore don't have a lot of experience and/or knowledge to call upon.  Any ideas?

0 Kudos
Message 1 of 7
(2,926 Views)

The simplest solution is to sample at a lower rate. Instead of 1Hz, why not sample at 1/60 Hz?

 

How are you currently polling the pressure sensor? Are you using a loop with a time delay? Seeing your code will help tremendously in suggesting a solution.

0 Kudos
Message 2 of 7
(2,924 Views)

I agree that the simplest solution would be to lower the sampling rate, although I need the 1Hz data in case there are any anomolies that occur during data collection so I can go back and review what happened at a finer scale.  As I mentioned, I am new to LV and this is the first code I've worked on, so feel free to offer any suggestions to improve it (especially in regards to timing).  

Thanks.

0 Kudos
Message 3 of 7
(2,912 Views)

Hi,

 

I can't view your VI (i'm working on 2010), but you could simply check your data is non-zero (use the comparison pallete) and only write these values to your file (use a case structure).

 

-CC 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 4 of 7
(2,910 Views)

That is what I am trying to do now but unsure of how to go about it.  Any quick and dirty suggestions or examples?
 

0 Kudos
Message 5 of 7
(2,907 Views)

HI,

 

Below is a vi snippet from your code. It looks at the first element of your data, checks if it is zero and writes it to a file if it isn't. You can play around with the idea to get something to work....

 

As suggested above you can avoid all this if you samle at 1/60Hz. From your code it looks like the loop rate is being set by your acquisition - set at 1Hz and when you do your continuous resampling it generates 59 zeros to pad your signal.

 

If you prefer to average your data instead you could also try the option I put in the second vi snippet. This adds your data to an array and when the array reaches a size of 60 it averages the contents and starts a new array.

 

All the best,

Dave

 

 

 

answer.png

 

 

2.png

0 Kudos
Message 6 of 7
(2,902 Views)

I'll give this a try and see how it goes.  I really appreciate your help.

0 Kudos
Message 7 of 7
(2,899 Views)