03-04-2013 07:49 PM
Hello,
I am trying to extract data out of a while loop as my declarations update with respect to the iteration number. I have attempted to use both local variables and shift registers, but with no luck.
I have also done the following example: http://www.ni.com/white-paper/7585/en and it works like a charm.
I attached the PNG file with local variable declaration circled in red. Will attach a VI in the next respnose.
Thanks
Solved! Go to Solution.
03-04-2013 07:50 PM
Attached is my VI
03-04-2013 08:53 PM - edited 03-04-2013 10:04 PM
That's not a local variable, but a value property. It gets read exactly once at the beginning of each iteration of the outer loop, each time before the code in the inner loop ever writes to it.
Sorry, posting by phone. I'll look at the code later.
03-04-2013 10:10 PM
OK, looking at the code...
Can you explain what it is supposed to do? What's the purpose of the value property node read which only seems to update an indicator.
The inner while loop should proably be a FOR loop, because the number of iterations is known before the loop starts.
Your use of formula nodes seems overly complicated.
03-04-2013 10:20 PM
TacomV wrote:I have also done the following example: http://www.ni.com/white-paper/7585/en and it works like a charm.
The examples in this application note do not resemble anything in your code. Where is the connection?
03-05-2013 12:01 AM
Basically, I want to get the iteration value out of a while loop. The counter will keep incrementing, but the indicator will only update once the loop is finished, not during the loop.
03-05-2013 12:03 AM - edited 03-05-2013 12:04 AM
Then you need to read it in a second loop that runs in parallel.
(run your code in highlight execution mode while watching the diagram to get a better understanding what your code is doing)
03-05-2013 12:06 AM - edited 03-05-2013 12:07 AM
To my nowledge it is being run in a parallel while loop. One while loop inside the false case statement, and the local variable being written in the while loop running the whole program.
03-05-2013 12:13 AM
No, the two while loops are stacked and not parallel, meaning the outer loop cannot go to the next iteration until all code in it, including the inner while loop has completed.
03-05-2013 12:18 AM
Ah that makes sense. Thank you very much.