LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

while loop to 10, then break

Solved!
Go to solution

 

 

 I want to have a counter that stops if the number is achieved. I tried with a for loop, however when the number was achieved it immediatly jumped to 0 and started doing it all over agan. (it seems there is no break in the for loop). 

How can I make while (i < 10)  i++;    

 that actually stops totally when i = 10 ?

 

 

 

 

 

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 7
(3,334 Views)

You code actually does what you describe.  It does stop at i = 10. 

 

Your graph however only displays one point; the last one with a value of 10.

 

Right-click on the tunnel (blue square on the right of the While Loop) and select "Enable Indexing" and run it again.

You should see something similar to the chart below (I changed the x-axis scale to 10)

 

R

 

Message Edited by JoeLabView on 10-18-2008 08:37 AM
0 Kudos
Message 2 of 7
(3,318 Views)

 

i now shows i in the graph, however it does not stop when i reaches 10. It starts all over again. How can I make it stop looping, after it has reached 10?

Message Edited by antonedwin on 10-18-2008 08:06 AM
0 Kudos
Message 3 of 7
(3,312 Views)
As Joe already told you, your VI does stop at 10. The only possible way that you are seeing it start over is if you are doing something really silly like using the run continuous button.
0 Kudos
Message 4 of 7
(3,291 Views)

 

In that way it counts to 10. Is there any way the same can be done in run continously mode?

 

 

0 Kudos
Message 5 of 7
(3,282 Views)
Solution
Accepted by topic author antonedwin

You have to click on the run button, not the run continuous..  And did you enable indexing?

 

R

 

Message Edited by JoeLabView on 10-18-2008 12:22 PM
Message 6 of 7
(3,276 Views)

antonedwin wrote:

 Is there any way the same can be done in run continously mode?


The "run continuously" is a debugging tool and is not meant to run a VI normally. A better name for that button might be "restart VI from the beginning whenever the program finishes". 😄

Message 7 of 7
(3,260 Views)