Telling Labview which loop to execute first

I have two For Loops in Labview and I’m not sure how to tell it which loop to execute first.

In C language you would just have:
A For Loop {

}

B For Loop {

}

The first loop that it would execute would be the A Loop because its in the top.

So do I need to arrange the blocks some way so it does not execute both of the loops at the same time?

Well, let’s say you want your first For Loop to run 20 times. You could wire the ‘i’ in the For Loop to a Comparison. Compare the value of ‘i’ to 20, then make a Case Structure with the T/F value that results from that comparison. If the value is True, then run the second For Loop, if it’s false, don’t do anything.

Just tested it out and it works. You make one big For Loop, a Case Structure inside that For Loop that is only true when certain amount of iterations of the big For Loop have taken place and another For Loop inside the True value of the Case Structure.

Nope. The sequencing is defined by dataflow. If one loop produces something that the other reads, they are automatically ordered. If no data dependency exists, LV assumes order isn’t important and allows them to run at the same time.

If you want to order them, you can take an output of the first and wire it to the second, even if it isn’t really needed. A better procedure if you are doing I/O – which is where sequencing may also be important even where there is no data. Take the error wire from the I/O in the first loop, and wire to the input of the I/O in the second loop. This has the added benefit of actually chaining the errors.

Greg McKaskle

Here’s a demonstration of a For Loop executing before the second For Loop.

http://www.2shared.com/file/4782115/3068073f/Ordered_For_Loops.html

Thank you.

Or you can use a sequence structure, which is designed for this type of thing. Place the first for loop in the first frame of the sequence, the second for loop in the second frame. Use a flat sequence to make it really easy.

See here for reference

–Ryan