# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## labview

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

Message 1 of 5
(1,925 Views)

## Re: labview

(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.

Message 2 of 5
(1,918 Views)

## Re: labview

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

Message 3 of 5
(1,913 Views)
Solution
Accepted by topic author Vikaspeddanagiredy

## Re: labview

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.

Message 4 of 5
(1,908 Views)

## Re: labview

Hi,

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

Message 5 of 5
(1,897 Views)