LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

search in an array between two values

Solved!
Go to solution

I have an 2d array of about 100000 sorted elements in the first index, I need to derive the subarray whose values are included between a lower and upper bounds (not the array index, but the value contained in them). The element-by-element comparison is too slow. How can I do?

0 Kudos
Message 1 of 5
(1,807 Views)
Solution
Accepted by topic author nept

If the limits exist in the array you can use "Search ordered array" (or Search 1D array) for them and then use those indeces with a Array Subset. If the limits are arbitrary you'll need to use Threshold array.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 5
(1,801 Views)

thanks!

0 Kudos
Message 3 of 5
(1,779 Views)

"Threshold 1D array " can efficiently search a nondescending array and you can round up or down to the next integer to either include or exclude the boundaries. I would recommend that instead.

 

(for the second limit you can even change the start index).

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

@altenbach wrote:

"Threshold 1D array " can efficiently search a nondescending array


 

Here's what I had in mind:

 

 

altenbach_0-1652721457711.png

 

Message 5 of 5
(1,751 Views)