|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
||||
|
||||
|
Re: Telling Labview which loop to execute first
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. |
|
#3
|
|||
|
|||
|
Re: Telling Labview which loop to execute first
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 |
|
#4
|
||||
|
||||
|
Re: Telling Labview which loop to execute first
Here's a demonstration of a For Loop executing before the second For Loop.
http://www.2shared.com/file/4782115/...For_Loops.html |
|
#5
|
|||
|
|||
|
Re: Telling Labview which loop to execute first
Thank you.
|
|
#6
|
||||
|
||||
|
Re: Telling Labview which loop to execute first
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why is it telling me no code.... | programmr | C/C++ | 5 | 28-01-2009 08:43 |
| execute.h | magical hands | Programming | 2 | 10-03-2007 21:02 |
| EasyC: Execute code before autonomous | Greg Marra | Programming | 7 | 07-01-2007 21:30 |
| How I can execute Javascript into Perl? | TomS | Programming | 3 | 22-08-2006 16:35 |
| Pact of Secrecy (Stop Telling US!) | Joe Matt | Rules/Strategy | 17 | 30-01-2002 01:02 |