LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

select only even

yeah, i already have a search devices and put them in the array.
the code is not the actually code i am working with.
there are more stack sequences than that..
hahaha. Smiley Indifferent
but yeah..i made it easier to ask questions when i know how to do things on my own..
so i created a module positions to stimulate what i already have..

Best regards,
Krispiekream
0 Kudos
Message 21 of 47
(2,190 Views)


krispiekream wrote:
i want to click adv to go to the next position where there is a device for instants.

That's exactly what my code does!
 
At the beginning, we need to start searching at position 0. After we find the first TRUE, (e.g. at position 5), we need to start searching at position 6 (5+1), the first postion after the element we found to find the next TRUE.
  • If we would start searching again from zero, we would find element 5 again, the one we already found.
  • Same if we would start searching at position 5, for example.

In your original code, you start searching at position 0, then position 1, etc. irrespective of where you found the first TRUE. This is incorrect coding.

Message 22 of 47
(2,197 Views)
i wanted to display on "CurrentPosition" is the device i am testing with.
so that currentposition can only be at 1,3,5,7,9
currentposition is not the position of the index


what this code is doing is correct,
but instead of clicking advance twice to increment to the next TRUE position.
i just want to click once.




Message Edited by krispiekream on 05-07-2008 11:07 AM
Best regards,
Krispiekream
0 Kudos
Message 23 of 47
(2,197 Views)
LabVIEW start counting at 0, not 1.
 
Just insert a "+1" in the wire going to the indicator. Simple? Right! 
 
 


Message Edited by altenbach on 05-07-2008 09:10 AM
Message 24 of 47
(2,193 Views)
It's not advanced math 😄
 


Message Edited by altenbach on 05-07-2008 09:12 AM
Message 25 of 47
(2,186 Views)
Best regards,
Krispiekream
0 Kudos
Message 26 of 47
(2,180 Views)
Do you ever read any replies?
  • You are still incrementing blindly "from the old search position" instead of "from the found position".
  • You are again using a local variable for no good reason.

 

Message 27 of 47
(2,177 Views)
that logic is correct,
but how about if my positions are not always odd elements?
i dont wnat to add by one all the time right?

Best regards,
Krispiekream
0 Kudos
Message 28 of 47
(1,694 Views)


krispiekream wrote:
but how about if my positions are not always odd elements?
i dont wnat to add by one all the time right?

Yes, you do! If you define the first element (index=0) as #1, you need to add 1 for all other indices too. It does no matter where the position is.


Message Edited by altenbach on 05-07-2008 09:22 AM
Message 29 of 47
(1,689 Views)
sorry about the local variables i tried not to, but i cant help it.
i didnt know how to initialize current position to 0 since it labview remember the last position it was at.
okay..
lets forget about the odd elements...
how about i want to let the user select the element?
0,1,2,3,6,7,9

and current position always start at 0.
click advance to go to 1,
click advance again to go to 2
click advance again to go to 3
click advance again to go to 6
click advance again to go to 7
click advance again to go to 9




Message Edited by krispiekream on 05-07-2008 11:28 AM
Best regards,
Krispiekream
0 Kudos
Message 30 of 47
(1,686 Views)