LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

for loop beahviour

hello everyone,

sorry for the stupid question, but I have a problem with a for loop.

In the following scheme

 

 

the second "for" loops only once. If i do not connect the two loops, the second for works correctly (and the index i goes rightly to 1 after the execution), while if i connect them the index stops to 0 (so, I have only one iteration instead of two).

Do you know where could be the problem?

 

Thank you a lot in advance

0 Kudos
Message 1 of 4
(2,691 Views)

Hi There,

 

This is the expected behavior, a loop will only execute when all it's input are available. If you don't wire the 2 loops, then you launch parallel processes>>they will execute as soon as possible. If you wire them , then the second loop waits for the first to be completed before starting.

 

Matthieu

Message 2 of 4
(2,688 Views)

Please attach an image that shows readable code, or even simply attach the VI. There is no way to tell what is going on from your blurry image.

 

  • What are the values of the diagram constants wired to the various N's?
  • Which of the tunnels are autindexing? Which one's are plain?

 

A FOR loop will loop as many times as given by N or by the array size of the smallest autoindexing input array, whichever is smaller. For example if an autoindexing input array is of size=1, the loop will only spin once, no matter what you wire to N.

Message 3 of 4
(2,680 Views)

ok, thank you so much. Now I understood my problem.

 

ps: sorry for the blurry image.

0 Kudos
Message 4 of 4
(2,666 Views)