# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

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

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
Message 1 of 8
(3,834 Views)
Solution
Accepted by topic author Benjamin_

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

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
Message 2 of 8
(3,823 Views)

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

What about auto indexing a for loop?

Message 3 of 8
(3,813 Views)

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

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
Message 4 of 8
(3,808 Views)

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

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

Thanks!

Stay Hungry, Stay Foolish
Message 5 of 8
(3,802 Views)

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

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)

Message 6 of 8
(3,788 Views)

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

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.

Message 7 of 8
(3,777 Views)

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

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
Message 8 of 8
(3,748 Views)