LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to slide averaging a 2D array

I got couple of questions for using LabView:
 
1. Is there any easy way to slide average a 2-D array in one direction?
 
2. How can extract median value instead of mean value in the sliding average process?
 
3. How can smoothing filter be used for this purpose? The filter doesn't like an array to be its inputs. What is dynamic data? Could some one give me an example.
 
Many thanks!
 
bing
0 Kudos
Message 1 of 6
(3,780 Views)

bing,

1) The easiest way to do this is to use the "Filter" express VI and select a smoothing filter

2) You can use the "Median Filter.vi" to do this

3) Dynamic data is just a generic type of data that express VI's use for their inputs and outputs.  Converting to and from express data is easily done using the "Convert from Dynamic Data" vi and the "Convert to Dynamic Data" vi.  When you wire an array into an input that takes dynamic data it will typically put the "Convert to Dynamic Data" vi in there for you.  If not you can always place this manually.

I hope this helps,
Justin D.
Applications Engineer
National Instruments

Message 2 of 6
(3,750 Views)

Thanks, Justin. This is very helpful!

 

Bing

0 Kudos
Message 3 of 6
(3,729 Views)
Justin:
 
You suggestions work quite well.
 
Just wondering if there is a way to replacing the "averaging" function with "median" function with smoothing filter.
 
Also, how the smoothing filter deals with the first and last a few data point that within the sliding window width?
 
Thanks!
 
Bing 
0 Kudos
Message 4 of 6
(3,712 Views)
Bing,
 
There is no way to replace the averaging filter in the filter VI with a median filter.  I would suggest putting the filter vi in a case structure and you can select which type of filter you want by selecting a given case.  As far as how the smoothing filter deals with beginning and ending values it looks like it assumes zero values for before and after.
 
-Justin D
Message 5 of 6
(3,676 Views)
Justin: Thanks!
 
Bing
0 Kudos
Message 6 of 6
(3,665 Views)