LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview

Solved!
Go to solution

Hi,

             Cand you suggest how to implement the below functionality . I have a 1dimentional array. I want to search a number in array which is not present but i want to knw the index of the number where it lies in between. For example array contains 1, 2, 4 , 5 and i need to find element 3 , which is not present. But it lies between 2 and 4 . So i want to get the index of number 2 and 4. 

 

 

Thanks

Vikas

 

 

0 Kudos
Message 1 of 5
(1,932 Views)

(Next time try to use a more useful subject line. This is the LabVIEW forum and every single post is about LabVIEW!)

 

Are the values always sequential? What if the array is [-2, 7, 4, 9, -12, 55} for example? What if the gap is more than one element wide?

 

What have you tried so far? Show us what you tried and we will give you suggestions on how to improve it.

0 Kudos
Message 2 of 5
(1,925 Views)

Hi,

            The values in array are in increasing order. i want to find the in which range the search element lies example .. array values are  2 5 8 10 and my search element is 7 .Then i want the result as 1 , 2 which are the index of elements 5 and 8. This is because 7 can fall in between 5 and 8

 

Thanks

0 Kudos
Message 3 of 5
(1,920 Views)
Solution
Accepted by topic author Vikaspeddanagiredy

Your specifications seem incomplete. For example, what should the output be if the search element exists?

 

Again, what have you tried so far and what is giving you problems?

 

Have you tried  "threshold array", then round the result down to the next integer for the lower of the two values, and add 1 for the higher value.

0 Kudos
Message 4 of 5
(1,915 Views)

Hi,

       Thank you so much. I have used threshold 1d array function and got the solution

0 Kudos
Message 5 of 5
(1,904 Views)