LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

updating local variables

Solved!
Go to solution

I want to acess the value of a variable  outside a loop even befor the loop is over So i am trying to creat a local variable and use it to transfer data outside the loop to do processing simulataneously online.

 

However i am only able to update one indicator outside the loop with the updated variable name..but if i draw a wire from there to do some processing the value in the wire is not updated...

 

I have tried two versions and updated the same..only one numeric indicator gets updated..numeric2 is always not updated..why?

 

how can it be solved?

 

0 Kudos
Message 1 of 10
(8,125 Views)
I forgot to upload the files in the previous post
Download All
0 Kudos
Message 2 of 10
(8,124 Views)

Of course Numeric 2 is not updated continuously. It's only executed once since it's not in any kind of a loop.

 

You should take the free LabVIEW tutorials.

Message 3 of 10
(8,118 Views)

I understand that numeric2 is not in any loop .

BUt even if i put two loops and try to pass the value from inner loop to outer loop immedieately the data does not seem to be flowing..even though i have made it as a local variable.

please see the attached vi.

0 Kudos
Message 4 of 10
(8,111 Views)

Hi siva,

 

did you read Dennis' message? Have you looked through the free online courses?

 

When you would have done so, then you would be testing your vi in "highlight" mode. And then you would have seen, that the local is only read once (probably before the inner loop starts). Then it will be read again after the inner loop has been finished...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 10
(8,104 Views)
Solution
Accepted by topic author siva0182

During iteration of the inner loop the outer loop will not update. See example for a quick fix LV 8.6.1. Try not to use local variables unless absoulutely necessary.

Message 6 of 10
(8,102 Views)

thanks for the update..But is ther eany other alternative to local variables.?

 

I did try to acess the free tutorials but i see only getting started stuff and basic tutorials..

0 Kudos
Message 7 of 10
(8,094 Views)

siva0182 wrote:

thanks for the update..But is ther eany other alternative to local variables.?

 

I did try to acess the free tutorials but i see only getting started stuff and basic tutorials..


 

I wrote this Nugget on Action Engines to answer just that question.

 

Have fun,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 8 of 10
(8,087 Views)

I usually only use to initialize a control on startup not to pass data. We usually pass data through a queue which adds a level of complexity, but gives you control of your data. The problem with locals is if you use multiple locals in multiple places all linked to the same indicator you lose control of data timing. Even worse if you write to it in multiple places. If your just using it in one place in a simple application where update timing and such aren't critical then it should be fine.

0 Kudos
Message 9 of 10
(8,081 Views)
It seems that the getting started stuff and basic tutorials are exactly what you need. In both the first and second VIs, you show a very basic misunderstanding of dataflow.
Message Edited by Dennis Knutson on 09-24-2009 10:01 AM
Message 10 of 10
(8,079 Views)