LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can you change the value of "N" (forloop) during iterations?

Hello,
I am wondering how to change the value of "N" in a for loop. The thing is that, when a certain condtion is not met, the for loop needs to increment the value of "N".

The code in c++ would look like this...

for (i=0; i<=max; i++)
{
if (condition)
{
max+=1;
}
}
Is this possible with labview?
Thanking you in advance,
D.S
Message 1 of 4
(3,197 Views)
No. The number of itertions of a for-loop is not changeable after it has started to execute.

If the number of itertions is unknown prior to running the loop, use a while loop.
Message 2 of 4
(3,197 Views)
Thanks!
I've already implemented the while loop and it seems to working fine!
0 Kudos
Message 3 of 4
(3,197 Views)
demo wrote:
> Hello,
> I am wondering how to change the value of "N" in a for loop. The thing
> is that, when a certain condtion is not met, the for loop needs to
> increment the value of "N".
>
> The code in c++ would look like this...
>
> for (i=0; i<=max; i++)
> {
> if (condition)
> {
> max+=1;
> }
> }
> Is this possible with labview?
> Thanking you in advance,
> D.S
Dont't think so; use a While loop instead.
Message 4 of 4
(3,197 Views)