LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving the maximum number

Help!! How do I save the maximum number? For example , I want the maximum value but if I were to have the next number, it shows the next number as the maximum value instead of my pervious maximum number which is a larger number . The first picture is how I got my values. It is just a sum of other values. What I want is to store the maximum number into the system.

derp.png

Here below is how I get my maximum number. But it keep changing wether the fact that the next number is smaller or larger then my current value.

Is there a way to store the maximum number? I only want the maximum number to change if the next number is bigger than my current maximum number. 

derp3.png

 

 

0 Kudos
Message 1 of 9
(4,208 Views)
You should really stop and take some of the free tutorials. The solution is to use a shift register. I have no idea why you have so many local variables and why the min/max function is not in your main loop. Those should get fixed after you learn the basics.
0 Kudos
Message 2 of 9
(4,186 Views)

Untitled_1d.png

 

Is this what you are trying to do?

0 Kudos
Message 3 of 9
(4,183 Views)

I think the shift register combined the Max & Min is the right answer.

You can also consider the Array Max & Min PtByPt VI,

http://zone.ni.com/reference/en-XX/help/371361J-01/ptbypt/array_max_min_ptbypt/

 

0 Kudos
Message 4 of 9
(4,163 Views)

no need for a SR, just use...

MinMax BD.png

0 Kudos
Message 6 of 9
(4,121 Views)

Hi apok,

 

how do you call (a single instance of) PtByPt-ArrayMinMax when you have 5 different scalar values to work with?

 

You need to build an array from your scalar values and you need to call your PtByPt function in a loop to get a proper result.

It's much easier to use the plain ArrayMinMax function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 9
(4,114 Views)

@GerdW wrote:

Hi apok,

 

how do you call (a single instance of) PtByPt-ArrayMinMax when you have 5 different scalar values to work with?

 

You need to build an array from your scalar values and you need to call your PtByPt function in a loop to get a proper result.

It's much easier to use the plain ArrayMinMax function…


it looks like th Op wants maximun number of the addition of the 5 values and not maximun value of any one value

0 Kudos
Message 8 of 9
(4,104 Views)

@GerdW wrote:

how do you call (a single instance of) PtByPt-ArrayMinMax when you have 5 different scalar values to work with?

 

You need to build an array from your scalar values and you need to call your PtByPt function in a loop to get a proper result.

It's much easier to use the plain ArrayMinMax function…


That's how I do it, but others might just drop down 5 copies of the PtByPt-ArrayMinMax and wire one to each of the scalar values.

 

Edit: or as mentioned this might be the max of the addition, more information from OP is needed.

0 Kudos
Message 9 of 9
(4,103 Views)