LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a local variable to change an indicator to a control

I am trying to read an array (indicator) then change it to a control (using a write to locoal variable) in a sub vi of a larger program. I want to do this so that I can make changes to the array then proceed to do other manipulations. The problem is that the local varibale is not reading the indicator, not sure why. I have attached the vi, Labview 5.1
0 Kudos
Message 1 of 5
(3,126 Views)
In order to change the value of a control (or indicator) from a subVI, you have to use a reference. A local variable, by coincidence, has local scope, and therefore can only be affected by within the program it is located, not a lower or higher level.

If you search through examples, the help, or NI's website, you will find some documentation on using references to pass or alter values. Be aware of race conditions.
Message 2 of 5
(3,126 Views)
If I read this right you are trying to read 'all rows' into 'unsorted' and
then 'unsorted' into 'unsorted control'. If you turn on troubleshooting
(the lightbulb) you will see that 'unsorted control' is writing to the local
'unsorted'. 'All rows' is also writing to 'unsorted' but it always gets
overwrited then by the other one. What you want to do I think is make a
local (write to) variable of the 'unsorted control' and write to that.

"Gorelick" wrote in message
news:506500000008000000605C0000-1031838699000@exchange.ni.com...
> I am trying to read an array (indicator) then change it to a control
> (using a write to locoal variable) in a sub vi of a larger program. I
> want to do this so that I can make changes to the array then proceed
> to
do other manipulations. The problem is that the local varibale is
> not reading the indicator, not sure why. I have attached the vi,
> Labview 5.1
Message 3 of 5
(3,126 Views)
Gorelick,

You have a very unusual feature in your code that confused me for a while: Your data flow goes from RIGHT to LEFT! You put the data source (control) at the right and the data sink (local variable) at the left.

What happens in your code is that "Unsorted" is assigned twice in a loop: one write to the terminal and one write to the local variable.

If you provide a more detailed description of the task you want to do, we may help you further.


LabVIEW, C'est LabVIEW

0 Kudos
Message 4 of 5
(3,126 Views)
Thanks for time, I acutally was able to figure it out from the previous suggestion. Cheers!
0 Kudos
Message 5 of 5
(3,126 Views)