LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For loop to get average

Hi Gerd,

I have another question in your program. Whats the purpose of adding iteration value(of while loop) to the signal, before the multification? Is it something to do with cordinating the for loop?

Thanks,

Ravi.

0 Kudos
Message 11 of 28
(1,547 Views)
Hello Ravi,

its just to have nice values 🙂

(Explanation: If I don't add the index to the signal, then the first value of the signal changes from one iteration to the other. It seems to be a 'flaw' in the express vi and has to deal with limited resolution of the DBL representation, as the value changes from 1e-16 to ~1e-14.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 28
(1,544 Views)

Hi GerdW,

I need one more help. If I have another counter called 'line counter' as in the diagram, and I want to save mean values to an 2-D array. Each row should be the mean values obtained when line counter is true. I want to save this to a file as a matrix. I tried to use case structure so that each row can be filled to the 2-d array when it is true. But I do not know how to build the array. Please help.

Thanks,

Ravi.

0 Kudos
Message 13 of 28
(1,529 Views)
Hi Gerd
I have a similar problem to Ravi and I'm still very new to labview so maybe its trivial. I am simulating data (1000 points) with random noise and I want to signal average the sets of data
to retrieve the signal with reduced noise. I'm displaying  the data after every new scan. I can't work out how to average the arrays of  data as they appear. Everything I I try seems to just average all the  data ponts  in an individual data set.
Any help very much appreciated.
Regards
Terence
0 Kudos
Message 14 of 28
(1,658 Views)
Hello Terence,

I don't know exactly what you want. You simulate data generation and get 1000 datapoints. Then you 'average the data':
How do you average? (Do you use Mean.vi from advanced->statistics?)
What do you want to average (all points or just part of the 1000 points, which part of the 1000 points)?
Make this more clear, then we would be able to help you... Or have a look at unclebump message in this thread...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 28
(1,645 Views)

Hi,

First, try to give more details about what you want to do. Otherwise it is very difficult to help...

For example, you wrote "Each row should be the mean values obtained when line counter is true."

It means?

*Each row i filled with one value: the average computed when line counter is true => 15 values in your vi (when

*

Dai

LV 7.1 - WIN XP - RT - FP
0 Kudos
Message 16 of 28
(1,507 Views)
Hi,
 
First, try to give more details when you post something beacause otherwise it can be very difficult to help.
 
For example, you wrote "Each row should be the mean values obtained when line counter is true."
 
It means what?
 
* Each row of the 2D array has one value: the average computed when line counter is true =>
14 values 'cause it is when i is bigger than 5 so 6, 7, 8, 9 ... 19.
So you get in fact
Dai

LV 7.1 - WIN XP - RT - FP
0 Kudos
Message 17 of 28
(1,507 Views)
Hi,
 
First, try to give more details when you post something beacause otherwise it can be very difficult to help.
 
For example, you wrote "Each row should be the mean values obtained when line counter is true."
 
It means what?
 
* Each row of the 2D array has one value: the average computed when line counter is true =>
14 values 'cause it is when i is bigger than 5 so 6, 7, 8, 9 ... 19.
So you get in fact a
Dai

LV 7.1 - WIN XP - RT - FP
0 Kudos
Message 18 of 28
(1,519 Views)
Oups, I tabbed and it sent,
 
So what you get is a 2D array of 1 column and 14 rows.
 
Or
 
* you want the array to be filled with the averages computed before line counter is true
=> so again 14 rows but here filled with 1D arrays of different size : 1rst row X elements
2nd row X+1 elements etc.
 
Or
 
*You want the array to be filled  with 5 values on each rows : the averages computed since the last line counter = true
and you want line counter to be true every 5 iterations
 
So? What do you want?
 
And I note that what you are doing here with those two loops can be very dangerous because there is no synch between them
=> which loop will execute first?
 
So please explain what you want to do, clearly! Explain what you want to do with the data and where it comes from!
 
 
Dai

LV 7.1 - WIN XP - RT - FP
0 Kudos
Message 19 of 28
(1,526 Views)

Hi,

Sorry for my poor English.

What I am trying to do is, save values to the first row when line counter is true. That is when my 'other counter' is 0,1,2,3,4.  So it is more than one average value for the first row. Then from 5 to 20, 'line counter' is false and no need to save anything. When 'other counter' resets, again values from 0 to 4, line counter becomes high. I want to save those to my second row and so on.

for example, I may get 15 average values for the first row, another 15 for the second row.

Please let me know if this is not clear, and I will try to explain it again.

Thanks,

Ravi.

 

0 Kudos
Message 20 of 28
(1,523 Views)