09-04-2012 01:38 PM
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.
09-04-2012 01:42 PM
Your loop only runs once. What were you expecting?
What exactly are you trying to do?
09-04-2012 01:44 PM
From an array which I have obtained from measuring a device, I want to find out the maximum measured value.
09-04-2012 01:46 PM
@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.
09-04-2012 01:48 PM
Yes. But its returning the last value measured , not the maximum one.
09-04-2012 01:50 PM
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.
09-04-2012 01:50 PM
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"...
09-04-2012 01:52 PM - edited 09-04-2012 01:53 PM
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?
09-04-2012 01:55 PM
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.
09-04-2012 02:00 PM - edited 09-04-2012 02:03 PM
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:
(Removed some unneccessary stuff to focus on the problem...)