09-26-2005 05:11 AM
09-27-2005 01:35 PM
Hello Charu,
Thank you for posting! The easiest way to do this is by testing the current number with the highest
number you have seen so far. The attached VI is one such way. Make
use of shift registers to store your "running max" and your
"running min" and keep comparing the newly generated number against
the values you have stored. Please examine the attached example and let
us know if you have any questions!
Thanks for posting, and have a great day.
09-27-2005 06:21 PM
Hi,
Thanks for the help. Actually i am new to LV and i don't understand e'thing preety well. Can you please help me with one more problem?
I have to construct a VI that displays a random no. once every sec., and then i am trying to compute the average of the last four nos. generated, i.e. the average is displayed only after 4 numbers have been generated, else the average displays zero.
Well, i was trying to get this, but so far what i have got is aVI that is generating avearge, but that is not what i need.
Thanks for any help.
CL
09-28-2005 02:40 PM
Hello Charu,
Unfortunately I will be generally unable to provide you with specific example code for questions – generally we are here to provide you with support with any platform questions or problems that may arise.
To address the question of keeping a “running average” of some acquired data points, performing this task with only a small number of points is a task made easy with use of Shift Registers. Shift Registers are designed to store intermediate values in loops for use on subsequent iterations. For more information see the LabVIEW help reference, or the LabVIEW User Manual (page 136). To keep a running average you will need to add a shift register on the right of your loop to hold the most recent value computed and 4 on the left side of the loop to hold the last 4 values computed. To compute the average, sum the outputs of the left-hand side shift registers and divide by 4. I have attached a screenshot of what such a VI might look like.
Hope this helps! Please let us know if we can help out any further.
Regards,
09-28-2005 03:01 PM - edited 09-28-2005 03:01 PM
Message Edited by Chaos on 09-28-2005 03:05 PM
09-28-2005 04:15 PM