ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resample Buffered data from AI-READ to File

Hi,

I have a pb with my data acquisition : I'm using a PXI-4472 AI card and continuous acquiring data to file.
Until now all channels are acquired at the same frequency : Ok. I know this card does not support multi-frequency acquisition.
But I want save data at different rate : ex : first channel at the frequency desired (ex 10 KHz), second channel at frequency /2 : 5 Khz ... to reduce amouth of data in the saved file.
I know the amouth of data retrieve et each AI-Read (ex 2048 scaled data / channel), and the frequency divisor / channel.
What's the best way (performance) to process the scaled data tab (2 dim) from the AI-READ to save it in the file (using Write File +) with frequency divisor consideration.
And how to re
ad the data in the saved file after.


Can you send me an example please ???


Thanks"
Eddy DUCHENE
12 F Chemin de Boutary
69300 CALUIRE ET CUIRE

educhene@laposte.net
0 Kudos
Message 1 of 9
(3,985 Views)
Separate the channels you want to reduce and pass them to the Decimate.vi. It lets you choose the reduction factor, n, and decide whether to select every n th sample or to average n samples for each output point. Write a header to the file recording the decimation factor for each channel. When you read the file that decimation factor will tell you how to align the data.

Lynn
0 Kudos
Message 2 of 9
(3,985 Views)
The Decimate.vi ????

What's this ??

Eddy
Eddy DUCHENE
12 F Chemin de Boutary
69300 CALUIRE ET CUIRE

educhene@laposte.net
0 Kudos
Message 3 of 9
(3,985 Views)
Analyze>>Signal Processing>>Time Domain>>Decimate.vi. This VI is used to reduce the number of samples in a consistent way.

It is not included in the base package, only the Full or Professional packages of LV 7. It has been present in earlier versions also.

Lynn
0 Kudos
Message 4 of 9
(3,985 Views)
Thanks for your help : I didn't know this Vi.

But I'm doing the same thing using the vi Tab -> Decime Tab (I'm using a condition struct depending of the divide factor).

Thanks.

Eddy
Eddy DUCHENE
12 F Chemin de Boutary
69300 CALUIRE ET CUIRE

educhene@laposte.net
0 Kudos
Message 5 of 9
(3,985 Views)
Although possible, it is not easy to save all the data in a single file. The easiest way would be to separate the channels and to decimate the data according to your division/channel, before saving in SEPARATE files.
But apparently that's not what you intended to do.
Here is a way of storing data easily in a single file.
Assumming that you have 2 channels (works also on n channels), channel 2 being (virtually) sampled at half rate, if you replace your "unwanted" data with �empty string- but leave the Tab separators, your saved file will look something like
ch 1 TAB ch 2 RETURN
ch 1 TAB RETURN
ch1 TAB ch2 RETURN
ch 1 TAB RETURN
and so on�
Writing the file is not a problem.
Retrieving the data back is a bit more difficult, since you have to avoi
d confusing empty strings with zero values !

See the example.below for 3 channels.

If file size is really a problem, you should also consider saving your data in binary format, and not in ASCII.
Chilly Charly    (aka CC)
0 Kudos
Message 6 of 9
(3,985 Views)
Thanks for your solution, but I need to save data in binary format (due to perf pbs).

I've succeeded to resolve my pb, but I have done a lot off data manipulation (especially to read them from file).

Thanks.

Eddy
Eddy DUCHENE
12 F Chemin de Boutary
69300 CALUIRE ET CUIRE

educhene@laposte.net
0 Kudos
Message 7 of 9
(3,985 Views)
Hi there! I have the same problem with you. I am using the PCI 6052e to sample different frequency rates.

Is it possible that you can send me an example on how u did it. I am really having a hard time figuring it out. Thanks!
0 Kudos
Message 8 of 9
(3,985 Views)
Ok,

So I'm retrieving scaled datas (max 8 channels) from AI-READ and transform them (2D tab) to save them in a binary file (using 1D tab).
To do that, I'm using the "Convert Scaled Data to Tab of Scaled Data With Divisor.vi" : it suppress data overflow for each channel (in case of divisor > 1) and save data in 1D tab.
After that, save this 1D tab in file using the "Write File+ [SGL].vi".

To read the binary file, I know the divisor parameter for each channel because I save it in the user header file.
Then I use the "Read_Datas_Acq_File_New.vi" to retrieve datas in the file depending of the Scan Begin and Scan End.

Good Luck !
Eddy DUCHENE
12 F Chemin de Boutary
69300 CALUIRE ET CUIRE

educhene@laposte.net
0 Kudos
Message 9 of 9
(3,984 Views)