LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

max value lower than Y

Solved!
Go to solution

My example and all of yours only work because 70 is the last value, but if you put it before the biggest value, it doesn't return 48 as the max value. It returns the last value until it reaches the value 70 in the array...

 

It stops seaching when it reaches a value bigger than 50 😞

 

 Muks, you example returns 50 as the biggest number... I need 48... I don't want to coerce the values...

0 Kudos
Message 11 of 18
(1,360 Views)
coerce.PNG
0 Kudos
Message 12 of 18
(1,359 Views)

This is what you have, right?

 

maxlowerthan.jpg

 

But notice that is I put 75  as the 4th value in the array, your code returns 35 as the higher value... it should return 45... 😞

0 Kudos
Message 13 of 18
(1,345 Views)
Solution
Accepted by topic author alpol

alpol wrote:

Thanks

 

[...]

 Maybe yous is better,jcarmody but I need the array intact to know the element position in the array

 

 

Any idea how I should know what index the value has in the array to identify the position of the value?

 

Now I need to know what 



Your question ignores the possibility of two elements sharing the distinction of being the highest value.  This solution gives the index of the first element with the highest value.  This is not very far from the original post I made.

Edit - mine works regardless of the order of the array.  Putting a high number early in the array won't affect the functionality.

Example_VI.png

Message Edited by jcarmody on 12-29-2009 09:59 AM
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 14 of 18
(1,342 Views)

Fun.png

Quite Simple but a fun exercize THANKS!


"Should be" isn't "Is" -Jay
0 Kudos
Message 15 of 18
(1,330 Views)

Thanks, both of the last two posts solve the problem of finding the max value lower than 50, but now I was going to add this to my program and I realyzed that what I need is the first index of a 2d array I have...

 

let's see... I have  for example

 

20 23 24 26

 

36 48 34 20

 

21 35 70 39

 

 

If this was my array, columns are values x1, x2, x3 and x4 and I need the number of the row, to retrieve the corresponding timestamp from a file...

 

 

again... any ideas?

0 Kudos
Message 16 of 18
(1,326 Views)

hi

without sorting, a vi i made - as i suggested in one post- is fairly easy, I attached here. it takes less than a second for an array of doubles of 32000 values.

for 2d you can build on this (or other examples), put another for loop.

n

Message 17 of 18
(1,309 Views)

Thank you all!

 

Problem solved

 

Happy new year to all of you!

0 Kudos
Message 18 of 18
(1,292 Views)