LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

filter 2d elements

Solved!
Go to solution
How do I make sure each filter is applied to the correct data point. I have attached a sample vi that uses cDAQ 9172 and a global channels of your choice. Seems like the subVI isn't picking up the proper data array to apply the filter to. Ideas!
Message Edited by bassinbc on 12-26-2008 02:51 PM
Download All
0 Kudos
Message 1 of 15
(4,636 Views)

Hello bassinbc,

 

i think there is a problem because you index data array  and filter array on for loop:

if i anderstood you want to apply ech type of filter on data array with differents option accordind to each filter

so un active indexation on both array and put unbundle off your for loop and cable 4 on N input loop

delete "off" case

 

keep us informed

 

@+

 

Tinnitus

 

 

CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 2 of 15
(4,619 Views)

I can't run vi  i miss a dll, daqmx and toolkit or driver !!! 

 

 sorry i didn't see well,

 

in fact you have an 2d array containing 4 channels 

 and want to apply one filter to each chan ?

 Tell me if i am correct this time

 

how 2d array is organised : one chan/ columns ?

 

Best regards

 

 

 

 

 

 

 

CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 3 of 15
(4,617 Views)
As noted, the problem is you're autoindexing from two arrays of different sizes. The for-loop will run only as many times as the smaller array. There is actually no need to pass the entire array into the subVI in the first place. You should only be passing the selected element of the array. Also, instead of using a subtract function with the constant of 1 on the block diagram, use the Decrement function.
Message 4 of 15
(4,611 Views)

Thanks but I still don't get it. I changed the vi to use queues. This will give me one element to pass to the subVI. Also, changed to the decrement function. Anyway, now I have the elements going to the subVI but still don't understand how to assure that the proper filter is applied to the proper data point.

 

 

Download All
0 Kudos
Message 5 of 15
(4,560 Views)

Why are you bringing queues into this? Smiley Surprised

 

All you needed to do was to change the IIR Filter Specifications control on the Filter VI from an array to a single cluster. In the main VI you just needed to use Index Array to index out the selected filter cluster based on the Filter control that you had. That's it.

Message 6 of 15
(4,554 Views)

I've got a couple of recommendations for you.

 

First, you don't need that many while loops.  As you have it set up right now, when you hit the stop button, all four while loops stop immediately.  Thus, your main while loop never iterates, and thus is not needed.  You can eliminate the main while loop and the while loop with the event structure (you don't need the event structure either).  Place your stop button in the DAQmx while loop and a local variable to the stop button in the filter loop.  This will allow you to stop both loops and will replicate the behavior of your current loop, while using fewer resources.

 

Also, you should either eliminate the "Convert To Dynamic Data" express VIs after your Split Signals function, or change them to "Convert From Dynamic Data" express VIs.  As it is configured now, you are converting dynamic data to dynamic data.

 

As far as the filter is concerned, the filter will be applied to whatever array is fed in.  As you currently have it configured, the for loop will iterate once for each channel in your array and apply the filter to the data that is currently available for that channel.  Then it will rebuild the 2D array and feed that out of the sub VI.  Are you seeing erroneous results with this method?

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 7 of 15
(4,552 Views)
This is a sample program that I made up quickly to get some feedback and advice. The actual program is much larger. I took you advice and removed the while loop and events structure. In my real program I do use queues. This sample program now seems to do the same as the larger program. I seem to get erroneous data, I mean when I apply one filter it applies the filter to more than one channel of data or there is some type of interactions between channels.
Download All
0 Kudos
Message 8 of 15
(4,540 Views)

hello,

 

I propose you this sub vi modification , i make some supposition ie: 2d array is 4 columns * X data points

if note it needs some ajustements.

also i noticed that you have inverted Fl and Fh so it can hangs filters if Fc > Fe;

 

make somme tries 

 

Best regards

 

Tinnitus

 

CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
Message 9 of 15
(4,513 Views)

Thanks tinnitus,

I changed the Fl adn Fh and that did fix the hanging up problem. Also, changed the vi to match your suggestions and it works but I still have some interaction. The interaction may be some other problem with the data, but I don't think so. Instead of using the constant of 4, I put an array size on the data and wired to the N terminal of the for Loop.

0 Kudos
Message 10 of 15
(4,507 Views)