LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search a 1D array using an upper/lower limit and retrieve index

Solved!
Go to solution

Had no success in finding something that I could modify for my purpose, so hopefully someone else can help. Still somewhat new to LabView, so some more obvious things are still sliding past my notice.

 

Long story short, I just need to be able to look at a 1D array of points (let's say [0.2222,0.3333, 0.4444, 0.6666, 0.7777, 0.8888, 1.0000], though it will normally be perhaps 100 - 500 points long) and ask whether or not there is a number between a range (let's say 0.5 - 0.8) and return the index of each point that does fall in that range to be used for some other purpose.

 

What might be the most efficient way to accomplish this?

 

Thanks greatly!

0 Kudos
Message 1 of 7
(4,123 Views)

Feed the Array into In Range and Coerce and you'll get an array of booleans that are in Range.  Then you can search that 1D array for the True values and get their indices.

Message 2 of 7
(4,122 Views)
Solution
Accepted by topic author brfi7385

Conditional tunnels, one of the nicer bits of syntactic sugar added to LV in a while:

 

InRangeIndices.png

 

Best in LV13+, but still not too shabby in LV12.

Message 3 of 7
(4,117 Views)

Unfortunately I have LV11, but the general idea got me there. Thanks!

0 Kudos
Message 4 of 7
(4,098 Views)

Hi!

 

Is there similar solution for the 1D graph and indices - upper/lower limit ... please see the code ?!

 

I would need the range +/- 5% from certain value and indices from array ...

 

Thanx!

 

Vasco

 

array-range-values-1.JPG

0 Kudos
Message 5 of 7
(4,011 Views)

@VASCO-1 wrote:

Is there similar solution for the 1D graph and indices - upper/lower limit ... please see the code ?!

 


I don't see any 1D graph in your code. Please explain what you want.

So you want to keep certain elements and their array indices. Is the output supposed to be a 2D array?

 

What are you trying to show with the two independent code parts (upper and lower). Please explain.

 

(The upper code is completely pointless and broken. The shift regsiter belongs on the outer loop boundary and the inner FOR loop is not needed. Why is the front panel and diagram maximised to the screen?? Why do you use a local variable instead of simply branching the wire.)

 

Also, since the current thread is already marked as solved, you should probably have started a new thread.

0 Kudos
Message 6 of 7
(3,984 Views)

Hi!

 

Sorry for being short with the data and explanation.

 

Basicly I would need to extract the data from the XY graph - at 3 different points with indices.

 

This would help me to explain the system properties.

 

So - I have settled value and what is the indices (time) at which this value is achieved ?!

 

Upper code is useles - I did not found the solution how to do it ?!

 

Thanx!

 

Vasco

Proporcional-PID-Academic-2.JPG

0 Kudos
Message 7 of 7
(3,970 Views)