LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find index of an array value greater than certain number

Solved!
Go to solution

Hello,

I am having a curve and I need a starting tangent of it, but random amount of values at start are useless so I need to find threshold, where the actual curve begins. For that purpose I built an array of the measured values and tried to find first value greater than certain number and it's index. I tried several ways to do that posted here on forum, but with no success.

I am having a LW 2009, could sb post a simplest possible VI that just finds first value in array greater than constant, and returns it's index?

And one minor question, is it better to build array of each value or just pull out graph history?

0 Kudos
Message 1 of 8
(9,982 Views)

"Threshold 1D array" does what you want.

 

If you by "graph history" mean to read the value of the graph, then yes that works just fine.

Certified LabVIEW Architect
0 Kudos
Message 2 of 8
(9,968 Views)

Well, I tried that, but I am unsure how this will work on real data with some fluctuations (meaning not sorted).

0 Kudos
Message 3 of 8
(9,953 Views)

How about "greater than" in a for loop?

Certified LabVIEW Architect
0 Kudos
Message 4 of 8
(9,948 Views)
Solution
Accepted by topic author Adalbertus

I will usually do a comparison of the array, then search the output array for instances of true.

 

Find Indices.png

 

0xDEAD

Message 5 of 8
(9,945 Views)

Tried for loop but the result was somewhat inconsistent, not sure what I've done wrong.

 

Will try the boolean array.

0 Kudos
Message 6 of 8
(9,936 Views)

Just noticed a mistake in this.

 

"Greater than zero" should be replaced with "Greater than or equal to zero" or it will miss a match if it is the zeroth element of the array.

 

 

0 Kudos
Message 7 of 8
(9,758 Views)

Here is an alternate method.

 

Alternate method.png

0 Kudos
Message 8 of 8
(9,737 Views)