LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with 'search 1d array vi....'

Hi,
 
I am trying to get the index of element calculated previously. This part of vi is localed on subvi, i am changging of value entry... and i need the index of element to adjust 2 arrays to others calculates...
 
The problem is , when i give the value to search on the vi, the search vi only works for the first time, or maybe 2 times, i know the problem will be a little stupidity, i am stuck with it right now...
 
I attached the vi to better view..
I appreciate your help!
 
Regards, Fonsi.
0 Kudos
Message 1 of 5
(3,203 Views)
Fonsi, as a quick suggestion I would say you could use a while loop that keeps running until the "search 1D array" function returns a "-1" (meaning "not found"). You bring the start index in through the use of a shift register on the while loop. Whatever you want to do with the indexes you find is up to you. See attached picture.
------------------------------------------------------------------------------------
Seriously concerned about the Labview subscription model
Message 2 of 5
(3,198 Views)

It is unlikely that calculations with DBL are identical to the last bit, you'll probably never get a match with your method.

Thy to find the element that is closest instead. (take the absolute difference, then the index of "array min" ). See attached, LabVIEW 7.1)

Message 3 of 5
(3,198 Views)

Sorry, maybe I misunderstood your question. If the calculation is identical, the elements will match using DBL. To get multiple indices if the array contains more than one of the desired values, use something like in the attached VI.

(Notice, that you need a +1 before feeding the index to the shift register or it will get stuck at the first found element)

Message Edited by altenbach on 10-02-2005 01:37 PM

Download All
Message 4 of 5
(3,197 Views)

Hi guys, 

Thanks aartjan!
Thanks altenbach!,

I finally used the first method from altenbach, I test it, and works perfectly!!. I only want to know the indice from this value to find!. Works well.

Thank you Altenbach, the method is very smart ;). It is easy and fast. I get new things to program g.. 🙂

Mensaje editado por Fonsi

0 Kudos
Message 5 of 5
(3,182 Views)