LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to filter a 2 dimensional array ?

I am acquiring data from 3 channels from the BNC 2090 through the 6052E. I would like to save and view the data in as real time as possible, with saving being the priority. Hence I have 2 parallel while loops. The primary while loop in which i read and save the data. A local variable of the saved array 'ecg-data' is displayed in a parallel while loop.

The array 'ecg-data' is a 2 Dimentional array. Since I wish to view a few seconds of the data toghter on the screen, I have made a for loop with shift register to save 2 itirations of the 'ecg-data'(to accumulate it) and then display it.

I am able to display this data beautifully, with no errors.

HOwever I wish to filter the data before plotting it. I would appreciate if someone can suggest a 'SIMPLE' code to filter the entire 2 Dimentional array at one go, without splitting it and displaying the waveform in the SAME WAY. ( converting to build a waveform is very long and windeed coding.)

I tried to split the 2d array and read the data column wise , filter it with a BUTTERWORTH FILTER ( takes 1D data) . But I am not able to view the post-filtereed data properly ( several seconds at a time)

I have added the PARALLEL loop of my code, in which I display the waveform.

I have tried transposing etc... nothing works...
0 Kudos
Message 1 of 3
(5,208 Views)
Hi There,

If you choose to use a traditional filter VI like the "Butterworth Filter.vi" instead of the new Express VI "Filter.vi", you have to use it the right way to filter multiple channels. The "Butterworth Filter.vi" has an input called "init/cont" (initialize/continuous). The Help states the following:
    "To filter a large data sequence that has been split into smaller blocks, set this control to FALSE for the first block and to TRUE for continuous filtering of all remaining blocks."
Since the VI is reentrant (see "VI Properties... >> Execution"), you will have to have an instance for each of the channels, so each VI can keep the continuous data from the certain channel. If you only use one instance of the VI and use a For Loop to index the different channels, the VI will not be able to keep track of the previous data for each channel, so the data will be mixed and the result will be incorrect.

Instead, use the "Index Array" function and a "Butterworth Filter.vi" for each channel (see the attached FilterMultipleChan.gif).

Good luck!
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 2 of 3
(5,149 Views)

I have found an alternative "Non-Express" solution that works for a finite number of channels.

Make a for loop

Place a case structure inside of the loop

wire the indexing terminal of the for loop to the conditional terminal of the case

Define the filter in case 0

Delete case 1

And duplicate case 0 for every channel you have. "BIG TIP:: if you use the text edit cursor and select the '0' and then press {ctl+Shift+Enter} it will duplicate the case you are on while incrementing the case #. TIP #2 Hold the key sequence down and it will repeat"

Wire the 2d array through and you should have it!!
 
-Norm Kirchner
~,~ The Captain Was Here
Message 3 of 3
(5,024 Views)