LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading running max-min from a VI

Can anybody plz help me with this one. i am a starter. i want to read the running max-min from a Vi. How can i do it? i have to read the max-min as the numbers are generated from the loop...
0 Kudos
Message 1 of 6
(5,065 Views)

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.



Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 2 of 6
(5,031 Views)

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

0 Kudos
Message 3 of 6
(5,021 Views)

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,

Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 4 of 6
(5,002 Views)
There are multiple ways to get a running average.  If you are using 7.1 I think there is even an express VI for this... With the above picture of diagram from last poster, you can check the iteration count from the loop and display zero if false or average if true.
 
Something like this... almost exactly the same 🙂

Message Edited by Chaos on 09-28-2005 03:05 PM

0 Kudos
Message 5 of 6
(4,998 Views)
Hello All,

That solution looks good too!  This thread, however, is a duplicate.  I ask that viewers please post to http://forums.ni.com/ni/board/message?board.id=170&message.id=144578 to keep 1 problem to 1 thread.

Thanks!

Regards,
Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 6 of 6
(4,983 Views)