LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

max value lower than Y

Solved!
Go to solution

Hi all!

 

Can someone help me find the max value lower than another value in an array?

 

example:

 

20   35

 

30   48

 

45   70

 

 

 

if I need the max value under 50, the biggest value would be 48. the value 70 would be ignored or taken out of the array...

 

Any help?

 

Thanks in advance and happy holidays

0 Kudos
Message 1 of 18
(3,788 Views)

hi

what you need is a sorting with a double condition :

 

if y(i)>y(i+1) AND < limit  then keep y(i)

 

it's easy to implement, depending upon the size of the graph the approach is more or less costly. if the array are veeery big make a search on the forum, there are some examples.

N

0 Kudos
Message 2 of 18
(3,784 Views)

This should do the trick.  (BTW - OpenG has a VI that'll replace my For Loop, as well as a ton of other VIs that can help.)

Example_VI.png

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 3 of 18
(3,776 Views)

Without a loop, you can also do it this way

 

max_min.PNG

0 Kudos
Message 4 of 18
(3,764 Views)

Thanks

 

I was going in circles and it was very simple... This is howdid it

 

 maxlowerthan.jpg

 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 

0 Kudos
Message 5 of 18
(3,762 Views)

 


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

 

I am reading this line the 4th time. a bit complex for me. ok did you check out the idea i suggested? the output of the array max-min will give you the index value as well. 

0 Kudos
Message 6 of 18
(3,757 Views)
Check out the vi attached
0 Kudos
Message 7 of 18
(3,756 Views)

Mine doesn't work... I didn't test it... 😞

0 Kudos
Message 8 of 18
(3,752 Views)

alpol wrote:

Mine doesn't work... I didn't test it... 😞


Do you mean the vi doesnt work for you???:smileyindifferent:

0 Kudos
Message 9 of 18
(3,750 Views)
Or do you mean to say the array you are getting is a 2d one?
0 Kudos
Message 10 of 18
(3,744 Views)