From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reducing Number of Data Points Acquired?

I am interested in knowing how to reduce the number of data points written to a file that was acquired at 5 Hz. I have tried to lower the sampling frequency below 5 Hz on a Compaq Daq, but I get an error saying that is an incorrect value. So, if I can't sample below 5 Hz, how do I acquire fewer data points, or how do I reduce the number of data points written to the file? I have tried Sample Compression which just ignores  data points. So, an acquired value is written multiple times at the same rate as having no compression at all. I calculated the sampling frequency from the data file witha compression ratio of 20, 30, and 40 to still be at 5 Hz.
0 Kudos
Message 1 of 12
(3,857 Views)

Hi NT,

 

Good Morning and I hope your well today. Thanks for your post.

 

What hardware setup are you using - what module?

Also, what signal are you acquiring from, what rate is it?

 

If you do have a limit, then I feel you have a few options.

 

1. Just ignore X samples i.e. if you want a rate of 1Hz, then dump the other samples to achieve that. 

2. Take a mean of the samples - if you wish to have some reflection of the data in your saved file

 

Please reply and I'd be happy to help,

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 2 of 12
(3,831 Views)

To add, for option 1 you can use the decimate 1D array function.

 

Felix

Message 3 of 12
(3,827 Views)

Thanks for the replies. Okay, I've tried the decimate array thing, but it doesn't appear to be doing anything. I let it run for a couple minutes and pasted it into excel and both files are the same length. I've created a new VI where it is reading in 3 analog channels with nothing connected to them. So, the values pulled in are just channel noise. Also, whenever it is writing to the data file it is writing two sample per line before starting on the next row.

0 Kudos
Message 4 of 12
(3,810 Views)

If you look at the data in a text editor, you will see that the decimate worked, but on the columns.

Write your data after the while loop and use the Write To Spreadsheet vi.

Propably you will need transpose array and a for loop for the decimate...

 

Felix

0 Kudos
Message 5 of 12
(3,802 Views)

Why do I need to write the data outside the while loop? The reason I ask is the real system I am working with is going to run for 14 days+. So, I don't think there is enough memory to hold all of those data points before they are written.

 

Also, what would be the best way for an averaging approach? Is there a way to create an array that would hold say 5 values at a time, one for each of the 3 analog channels, take the average of the 5 values, write the 3 averages to the file, and then clear the array for the next 5 value?

0 Kudos
Message 6 of 12
(3,798 Views)

I don't see how you can possibly say the decimate function does not work. Simply looking at the file size says it does and if you were to look at the data, you would see that your are reducing the 5 values to 2 - exactly what the decimate is supposed to do.

 

If you want the mean, just wire that up (Mean function is on the Mathematics>Probablility & Statistics palette) instead of the decimate. You'll have the 5 elements of the array going in and a scalar being output. Everything else (holding 5 values and being cleared for the next is already in your code.

 

p.s. You really don't need to do that whole mess with the Split Signal and Convert From Dynamic Data. Just use the Index Array and get Waveform Component. And instead of two Format Date/Time String, why don't you just use a single Get Date/Time String function? Another very strange thing about your code is all of the repetition of parsing, formatting, Write to Spreadsheet, etc. for the second file.

0 Kudos
Message 7 of 12
(3,781 Views)
If you want to "compress" your data then you should perhaps try the "Decimate (single shot) VI " Owning Palette: Signal Operation VIs. With this VI you can average down an array. If you have an array sampled with 5Hz and you set the decimating factor to 5, and average=true. Then the output will be an an array downsampled to 1 Hz, with each value equal to the average value of 5 samples in the input array. The decimate function is quite new. It came in Labview 8.2 


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 8 of 12
(3,764 Views)
Okay, I've tried to add that to my actual system, but no temperature data is written to the file, only the time stamps.  Why could this be? Also, it appears that the time stamps are being duplicated in the file, and the first few points have the 1901 time stamp.  Does this have something to do with the decimating?  How can I correct this?
Download All
0 Kudos
Message 9 of 12
(3,727 Views)
I have put the decimate function in my code in the previous post, but now no temperature readings are being written and the time stamps are getting written multiple times. How do I correct this?
0 Kudos
Message 10 of 12
(3,693 Views)