LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

easier way to calculate many means

Solved!
Go to solution

Hi there ,

 

I have a vector which I decimate in three other vectors and I calculate the mean of each of them.

I was wondering if any one knows a less messier way of calculating those means. Imagine if a I decimate in 100 vectors, my program will be a mess.

Please have a look at my program.

Thank you

0 Kudos
Message 1 of 4
(2,656 Views)
Solution
Accepted by topic author vlonjati

Here's one possibility.

 

Message Edited by altenbach on 12-17-2008 03:26 PM
Download All
Message 2 of 4
(2,649 Views)

Thank you altenbach for the help. Although I can not really understand how the decimation parts works, it just works fine.

I tested it using the attached program.

I think  labview  should have as many of sub vi like yours,  especially the decimation one, which are of general form.

Imagine if i had to decimate the vector in 100 one, it would be a killer doing it my way. 

I do not know where to suggest it, but is worth it.

 

0 Kudos
Message 3 of 4
(2,628 Views)

vlonjati wrote:

 Although I can not really understand how the decimation parts works, it just works fine.


It is actually pretty simple. Let's assume we want to use a decimation factor of 3 and we have the following 1D array.

 

1 2 3 4 5 6 7 8 9 0 1 2  (each digit is an element)

 

Reshaping according to my code rearranges it into a 2D array:

 

1 2 3

4 5 6

7 8 9

0 1 2

 

We want to average each column, however autoindexing a 2D array on a loop boundary operates one row at a time.

Since we want to operate on columns, we need to transpose the array first.

 

The rest falls into place. 🙂

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