LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use variable between different loops

Solved!
Go to solution

I have two inner while loops and I want too take an output variable from the first inner loop to another loop.

 

For example,  in the attached file if I want to take the value of x and use it in other loop to obtain value of y.

 

Please, any suggestions to solve this problem.

0 Kudos
Message 1 of 3
(665 Views)
Solution
Accepted by topic author Omda2022

Hi Omda,

 


@Omda2022 wrote:

I have two inner while loops and I want too take an output variable from the first inner loop to another loop.


Your problem description is not that good…

 

Your VI does exactly what you asked for: output a value from an inner loop and use that value in another loop!

 

Do you want to run both loops in parallel? Then you should "OBEY DATAFLOW!": right now you enforce the execution order by DATAFLOW.

 

There are techniques to exchange data between loops, like notifiers, queues, channel wires, local/global/shared variables, network communication, … (Not all of them are suitable for all purposes in the same way.)

 

General recommendation: You should learn to better describe your problem instead of focusing on just one (maybe broken) way to solve that problem.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(662 Views)

Great Thanks, Mr.  for your corporation. 

 

To solve the problem I used the "Communicating Data between Parallel Sections of Code Using Channel Wires" technique.

 

I will describe my problem better next time 🙂

0 Kudos
Message 3 of 3
(637 Views)