LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Holding Min and Max

Solved!
Go to solution

Hi,

I have a VI with multiple T-Couple channels. I got the channels split up and to the array max and min function. How do I hold the highest and lowest values for the entire run? Every time it receives new values(every 5 seconds) the max and min change to the latest data reading.

Thank you

0 Kudos
Message 1 of 16
(7,007 Views)
Solution
Accepted by topic author Amanda_Kay

Use a shift register to hold the max (or min) value, like this:

HoldMinAndMax.png

 

Is this what you mean or are you asking about something more complicated?

0 Kudos
Message 2 of 16
(6,984 Views)

If you have this running in a while loop that acquires the array of thermocouple readings it should look something like this with the MAX value held on top and the MIN value held below until stopped.  Be sure to preload the MAX with -INF and the MIN with +INF.

Hold MIN-MAX Values.png

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 3 of 16
(6,981 Views)

What do you mean by the INF's and what is the function in the middle?

Thank you so much

0 Kudos
Message 4 of 16
(6,971 Views)

@Minions wrote:

If you have this running in a while loop that acquires the array of thermocouple readings it should look something like this with the MAX value held on top and the MIN value held below until stopped.  Be sure to preload the MAX with -INF and the MIN with +INF.

Hold MIN-MAX Values.png

 

Try that and look at the output 

Spoiler
Max equal +inf And Min -inf Facepalm moment

Capture Start.PNG

Use NaN


 The middle function is "Build Array" and it is adding the current max and min the the array to test for max  and min


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 16
(6,967 Views)
Solution
Accepted by topic author Amanda_Kay

@Amanda_Kay wrote:

What do you mean by the INF's and what is the function in the middle?

Thank you so much


Here is what I meant by presetting the MIN & MAX values.  The vi in the middle is supposed to be a representation of all of your thermocouple readings being gathered into an array.

Hold MIN-MAX Values.png

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 6 of 16
(6,965 Views)

@JÞB wrote:

 

 

use NaN

 


Yes, tried to simplify without looking at the pitfall before me.  Back to the Etch-A-Sketch.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 7 of 16
(6,955 Views)

This might be a stupid question but how do I get the positive and negative infinities at the while loop end points?

0 Kudos
Message 8 of 16
(6,952 Views)

Nvm, I found it

0 Kudos
Message 9 of 16
(6,949 Views)

@Amanda_Kay wrote:

This might be a stupid question but how do I get the positive and negative infinities at the while loop end points?


Amanda,

 

Like Jeff wrote, you will need to simply create a DBL value and type in NaN (rather than +INF or -INF) by right-mouse-clicking on the shift register at the input to the loop then selecting Create > Constant.  To get the other constants, use the right-mouse-button (RMB) and select NUMERIC under the PROGRAMMING tab to find those options. 

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 10 of 16
(6,947 Views)