LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Evaluation while loop in for loop

Hi

 

i would like to ask how it si with evaluation while loop in for loop. I have made for loop with code and also a while loop inside it and i have to know when the evaluation of while loop starts. I think that it has to start after the code in one cycle of for loop is finished but i don´t know and i have no idea where can i find it. I would like to have fisrt evalution for loop after it while loop till stop condition and than new cycle of for loop and again.

I am beginner with labview so thanks a lot for help.

 

 

0 Kudos
Message 1 of 6
(2,717 Views)

It all really depends on your data flow.  LAbVIEW is a dataflow language.  So you have to see what data is available.  But the everything in a loop must complete before it can iterate.  Therefore, the While loop must complete before the FOR loop can iterate.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(2,713 Views)
Perhaps you could post a bit of your code to help us visualize what you are trying to accomplish?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 6
(2,696 Views)

Standard and easy way to control the order of program execution is to pass an Error cluster through every step. Even if you don't actually look at the error value, the error cluster that comes into one VI is passed out at completion, and any VI that is waiting for that error wire to be populated has to wait for that value to arrive before it executes.

Since I learned this trick I haven't used a flat sequence to control program execution for about 2 years.

Once your VI is ready to run, turn on "highlight execution" and single step through the code with the debugger. You'll see what happens and when. Sometimes you'll be surprised. Sometimes steps on the right side of the block diagram run what looks like "early" and you might think that the steps on the left would execute first. But physical placement in the block diagram doesn't mean anything.

If a step inside the iteration of the FOR loop needs a value that comes out of the WHILE loop, then the while loop will execute before the step that needs that input. But, if a separate step in the for loop doesn't rely on output from the while loop, then that step can execute first, or even simultaneously with the while loop. Labview executes a step when all of the necessary data for that step is ready.

0 Kudos
Message 4 of 6
(2,687 Views)

PS, pass your error cluster through the loops in a shift register, or labview will build an array of error clusters, which you don't want.

0 Kudos
Message 5 of 6
(2,685 Views)

Hi jeseter,

I think you might find useful this: Execution Structures in NI LabVIEW. It's part of Introduction to NI LabVIEW educational material that is available online for free. You can find other educational resources by simply using the search field on www.ni.com.

 

NI also offers broad range of training courses that can accelerate your learning. These can be led by instructor in a classroom, or self-paced online. See NI Training and Certification to find which fits you the best.

Jakub Prokeš
NIEE Aplications Engineer
0 Kudos
Message 6 of 6
(2,647 Views)