It sounds like what you are looking for is to average only the detected peaks rather than all of the data. And you want a running average meaning average of all the peaks collected. (What I had drawn was a running average, but of all data.) The alternative would be a moving average where it is the average of a point and N previous points. New point added, oldest point dropped.
A couple of tips. Make sure your wiring is from left to right. The stop button flows out of the right side, but you have it directed to the left to go into the stop condition terminal of the loop. Make sure you don't cover up wires. The whole loop has shifted and the wire branch for that initial 0 constant is covered by the loop and the labels overlap the loop. You have two formula express nodes in a row doing a multiply by 5 million. I'm not sure that is what you want. Also, when you post an image, you must attach it to your message and post the message to the forum first. Then you can go back and add the image to the message text by using the URL of the attached image. Your image in message 10 doesn't show up because it points to a location on your hard drive which the rest of us won't have access to.

I drew a scenario to do a peak detection though I didn't test it so it may have some flaws. There are several peak detector VI's in Labview (assuming you have a package higher than the base package.) Some do point by point, some operate on an array of data or waveforms. I would use the peak detector since you are collecting several data points at once. But in quickly playing with them, it seems like they do some interpolation of values between indices rather than just giving you the highest value that is actually in the data. Perhaps someone more familiar with peak detection can comment on this.
But let's assume there is a peak detector that does what you want it to and it provides an array of peaks. It sums the array of peaks, adds them to the running sum, and the count of peaks is added to the overall peak counter. These are tracked from iteration to iteration by way of shift registers on the outer loop.
Hopefully this gives you ideas.
Message Edited by Ravens Fan on
11-29-2007 11:06 PM