LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Min & Max Array

Hello

 

I am using the Min and Max array tool to find out the maximum number obtained in an array. 

But it returns to me the last number observed not the maximum one though.

 

Would be glad if someone can help.

 

 

0 Kudos
Message 1 of 14
(3,460 Views)

Your loop only runs once. What were you expecting?

 

What exactly are you trying to do?

0 Kudos
Message 2 of 14
(3,454 Views)

From an array which I have obtained from measuring a device, I want to find out the maximum measured value.

 

0 Kudos
Message 3 of 14
(3,447 Views)

@shubhi wrote:

From an array which I have obtained from measuring a device, I want to find out the maximum measured value.

 


That's what the Array Max & Min does.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 14
(3,434 Views)

Yes. But its returning the last value measured , not the maximum one.

0 Kudos
Message 5 of 14
(3,429 Views)

What part of "your loop only runs once" was not clear to you? Your array only contains one element. So the "last" and the "max" will be exactly the same thing.

 

If the code you are showing is not the code you are actually using, then show the code you are actually using.

0 Kudos
Message 6 of 14
(3,424 Views)

Hi shubhi,

 

your FOR loop returns an array of just one element: the result of "No.1" minus "No.2".

From that array (of just one element) you take (an unneeded) subarray and the calc the max of just that one element...

 

Nowhere in your VI is any control holding your "array which I have obtained from measuring a device"...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 14
(3,424 Views)

How large is your array going into the function?  If it is only 1 element, then you need to look at the issue upstream.  As has been said, your FOR loop only runs once.  Therefore your array is of the size 1.  I'm guessing there's supposed to be more to the example?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 14
(3,420 Views)

Hi All

 

This is code I am using.

The For loop calculates the difference between two consectuve readings and I aim to return the maximum difference attained from it.

 

0 Kudos
Message 9 of 14
(3,416 Views)

Hi shubhi,

 

your device only outputs scalar values. Your FOR loop is nonsense - as told several times before...

 

You have to use a shift register to keep older values:

check.png

(Removed some unneccessary stuff to focus on the problem...)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 14
(3,409 Views)