01-27-2010 03:25 PM
I have a variable inside a while loop, which i want to access outside the loop, i.e., in my VI, i have two indicators, one inside the loop and one outside the loop. The variable increments with each iteration. However, I am not able to see this iteration outside the loop. I only see the final value of the variable. Is there anyway for me to access the variable inside the loop as it is running. In terms of my VI, is there any way for my "inside" indicator to match the "outside" indicator? Any help with this will be very much appreciated. Thank you.
Regards,
Nishanth
Solved! Go to Solution.
01-27-2010 04:19 PM
Yes. You would use a local variable of the indicator "Inside" that writes to the indicator "Outside".
There are other ways of doing this as well such as passing the data through a queue or a notifier.
The concepts of tunnels, dataflow, and that data isn't available until the structure it comes from has completed, is all basic LabVIEW knowledge.
01-27-2010 04:27 PM
crickmaster,
It is not entirely clear what you are trying to do, but there are a variety of ways to obtain access to a variables outside of the loop where they are produced. Here is an example of a producer consumer loop where the variable is continually read. I had to put a wait on there so that the queue was not released before the variable had been read.
Another way to do this would be to simply use a local variable in the consumer loop. Depending on the loop speeds, you may not see all of the updates. And, you will have to have a way to explicitly stop the consumer loop from reading. In any case, to see all of the updates, the variable Outside will have to be in a loop so that it can be updated continuously and not just once as you have it currently.
Hope this helps. Peace, Matt
01-29-2010 02:10 PM