LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

counting the no of iterations of a while loop

Hi all,

I have a while loop and i need to count the number of times it execute. Is there a counter that is availabe to do this?

thanks

0 Kudos
Message 1 of 10
(4,116 Views)

Yes, if you already have a while loop, then you already have the counter.

The blue 'i' in the bottom left corner is the iteration number.

Just right click on it, and select Create >> Indicator.

Cory K
0 Kudos
Message 2 of 10
(4,108 Views)
Ya but my loop will be executing a no of times and i would need to know the final iteration number. how do i do this?
0 Kudos
Message 3 of 10
(4,099 Views)

Write the iteration count to an unitialized shift register.

 

Basic Shift Register.PNG

 

 

Have you tried any of the basic tutorials?

Message 4 of 10
(4,095 Views)

When the loop stops, the indicator will show the final count.  Just add 1 to it.

 

Or if you need to use that value later, wire it to the edge of the while loop.

 

 

Or do you mean that the while loop will be starting and stopping numerous times and you want the total iteration count?

 

 

Message Edited by Ravens Fan on 07-02-2009 12:13 AM
Message 5 of 10
(4,093 Views)

This?

iteration.jpg

 

 

Dennis' is good if you want to know your iteration in an addition series (0+1+2+3+4+5+...+n)

Message Edited by Chris_VH on 07-06-2009 10:11 AM
Chris Van Horn
Applications Engineer
Message 6 of 10
(4,033 Views)

Hey all,

 

Sorry for not being clear enough previously. The main issue I have is that I stop a while loop when a certain condition happens and i need to get the iteration value when the loop stops or when the condition is satisfied. I have tried using the select from comparision palette, but the problem I am having there is that I have to give an input if the condition is false which I dont need. So, Is there a better way of doing this?

 

Thanks for the help:)

0 Kudos
Message 7 of 10
(3,953 Views)

I would have thought that one of the examples given above would be the solution for you.  But there must be something to your request that you aren't adequately describing.

 

Please post your VI so we can see what you are trying to do.  Then we can come up with an answer for you.

0 Kudos
Message 8 of 10
(3,945 Views)
this might be what your talking about:
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 9 of 10
(3,941 Views)
Try the simple one.
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 10 of 10
(3,928 Views)