# LabVIEW

cancel
Showing results for
Did you mean:

## generate an average value

Hi everybody,

I have a question: I would like to generate an average value over the last 10 values. I know, there is a possibility by using a shift register, but, e.g., I would like to shift the values manually. More details: I would like to shift the values evry time a new value arrives. Any idea?

Thanks, Dennis
Message 1 of 5
(2,373 Views)

## Re: generate an average value

Your requirements seem to contradict each other, but maybe I don't quite understand the question. It can either happen (1) manually or (2) whenever a new value arrives. How do new values arrive? Where do they come from?

Can you post a simplfied version of your VI with a more detailed explanation?
Message 2 of 5
(2,369 Views)

## Re: generate an average value

I know, the description sounds a bit confused, but I try to explain it more detailed:
I have a solar application to which I send a command every 10 seconds. The solar generator answers to this command with a string of different values. In a second step I split this string to separate the values (e.g. voltage, current, power, temperature, ...). The power values are then displayed in a graph. But now I don't want to display each value, but an average value of the last ten values arrived. Now the problem: The shift register works with an intern loop (right?). But I would like to shift the values every time a new value arrives. Is that possible, or do I have to use the internal loop (and shift, e.g. every 10 seconds)?

Maybe I'm completely confused and I don't really know how the shift register works.....! 😉 But that would be very annoying...!

Sorry, the VI is at another computer at my lab, so I'm not able to send you the VI now. Maybe tomorrow.

Dennis
Message 3 of 5
(2,363 Views)

## Re: generate an average value

I might be confused on your problem, but I'll give you a possible answer. Seems like you have an inner loop with shift registers that are working correctly, and you want the outer loop to process the average of the last ten measurements instead of passing the individual measurements after each interation.

You can pass out your measured values from the inner loop to the outer loop and use shift registers on the outer loop to calculate the average value Hopefull this answers your question.
Message 4 of 5
(2,351 Views)

## Re: generate an average value

There is a vi available in the Analyze/Point by Point/Probability and Statistics PtbyPt palette called Mean PtbyPt.vi that should do the job without the need of complex shift register structures. Simply put it into a case structure within a loop and feed it with new data points whenever you want.

Best regards,

Jochen Klier
National Instruments Germany
Message 5 of 5
(2,335 Views)