LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While Loop Tunnel Help

Solved!
Go to solution

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

0 Kudos
Message 1 of 4
(6,749 Views)
Solution
Accepted by topic author crickmaster

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.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
Message 2 of 4
(6,729 Views)

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

test.png

Message 3 of 4
(6,728 Views)
I used the local variables since it seems to be less cluttered than implementing a queue.  Thank you both for looking into this!  It was of great help. 😃
0 Kudos
Message 4 of 4
(6,684 Views)