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: 

Mean single from a 2D array?

Solved!
Go to solution

Hi everyone,

 

I have small speed hump with my vi; hopefully somene can help...?

 

I have  a 2D array that contains 6 signals (strain gauge waveforms).  Need to calculate the average waveform across the 6 signals so that I have 1 response (waveform) signal... In matlab I would code it as:

 

mean_waveform= mean(2D_Array,2);

 

This has stumped me...? Any help would be greatly appreciated.

 

Kind regards,

Jack

0 Kudos
Message 1 of 4
(2,544 Views)

Assuming the sampling is synchronized so every waveform in your waveform array has the same dt and start time you could do the following. If they don't have the same acquistion start time, you'd have to set that waveform component manually.

 

Edit: woops I didn't see you attached a VI and that you have a 2D array of doubles. Just transpose the array then use my second for loop, ignoring the rest of the code I show. That should do it. It will output an 1D array, where each element is the average of the respective column in the 2D array.

 

 

0 Kudos
Message 2 of 4
(2,538 Views)
Solution
Accepted by topic author jcannon

Transpose the array, pass into a FOR loop with a Mean.vi in it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 4
(2,534 Views)

Thanks crossrulz and For(imstuck)...

 

Very much appreciated...

 

Regards,

Jack

0 Kudos
Message 4 of 4
(2,523 Views)