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: 

How to calculate a mobile mean value of N individual signals?

Solved!
Go to solution

Hi everyone,

 

My problem is as following:

With every sample I receive an array of 64 signals and I would like to build the mobile mean of each of these 64 signals.

However it is very poor to place 64 reentrant mobile mean VIs in parallel to do that (like shown in the attachment).

Therefore I am wondering if there isn't a better way to do that?

 

Every hint is appreciated

 

Benjamin

 

 

Stay Hungry, Stay Foolish
0 Kudos
Message 1 of 8
(3,670 Views)
Solution
Accepted by Benjamin_

Hi Benjamin,

 

whatever that "Mobile Mean" VI is: change it to accept an array.

In the VI there probably is a ringbuffer using a 1D array to hold data. Change that to a 2D array to hold values of all your 64 signals...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,659 Views)

What about auto indexing a for loop?

 

Autoindexing mobile mean.png

0 Kudos
Message 3 of 8
(3,649 Views)

Hi sebster,

 

that will average across all your different signals. I doubt the OP want that - as he already expressed...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,644 Views)

Gerd, you are right, a 2D array solved my problem.

 

Thanks!

 

Stay Hungry, Stay Foolish
0 Kudos
Message 5 of 8
(3,638 Views)

GerdW wrote:

that will average across all your different signals. I doubt the OP want that - as he already expressed...


you could probably get around it by making the FOR loop parallel and define 64 parallel instances. 😄

 

(still, I agree it would be better to make a scaleable subVI that accepts arrays directly)

0 Kudos
Message 6 of 8
(3,624 Views)

Benjamin Button wrote:

With every sample I receive an array of 64 signals and I would like to build the mobile mean of each of these 64 signals.


What does your "mobile mean" actually do? Isn't it the same as the current "Mean ptbypt" that ships with LabVIEW?

 

You did not show us any code, but a sloppy implementation could potentially be a real memory thrasher and it would be worth to double-check the code to make sure it is efficient.

An example of an efficient in-place implementation of the 2D version can be found here. Modify as needed.

0 Kudos
Message 7 of 8
(3,613 Views)

Hi altenbach,

Thanks for the hint but "Mean ptbypt" will not work in my case because my Mobile mean also filters out all NaN values so that my result will never be NaN.

By the way, have you ever had a look into the Mean ptbypt VI? My code is much simpler and without strings to control the behaviour which I think is a little strange.

 

I have to think about an in-place structure but on the other hand I have had never any problems with that part of the code 😉

 

 

Stay Hungry, Stay Foolish
0 Kudos
Message 8 of 8
(3,584 Views)