LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I pass variables by reference?

Hi!

Hopefully the last question before this ordeal is done:
is there a way to pass variables by reference. In particular
is there a way I can pass a reference to a property node
(for a graph) to a sub-VI to make changes (lots of changes
but rarely, so I do not want it to be in the main VI) and have
the changes affect the graph on the main VI's front panel?

Basically I need to change the colorscheme for an XY graph
on the fly depending on user input and there is no reasonably
efficient way I can precolor the graph (well there is but it
would mean intentionally creating empty datasets to skip
the colors not currently used, which is a very inelegant
solution).

Rudolf
0 Kudos
Message 1 of 3
(2,399 Views)
> Hopefully the last question before this ordeal is done:
> is there a way to pass variables by reference. In particular
> is there a way I can pass a reference to a property node
> (for a graph) to a sub-VI to make changes (lots of changes
> but rarely, so I do not want it to be in the main VI) and have
> the changes affect the graph on the main VI's front panel?
>
> Basically I need to change the colorscheme for an XY graph
> on the fly depending on user input and there is no reasonably
> efficient way I can precolor the graph (well there is but it
> would mean intentionally creating empty datasets to skip
> the colors not currently used, which is a very inelegant
> solution).


You might want to avoid referring to controls in the UI as variables
since
it can lead to confusion, but you can do this assuming that you
have version 6i or higher. If you popup on the control and choose
Create>> Reference, then this will give you a reference that can be
wired into the property or invoke nodes to make changes to the graph.

Greg McKaskle
0 Kudos
Message 2 of 3
(2,399 Views)
Here's a demo program that shows how to use control
references to simply change color of a boolean. Apply
the same techniques to your graph. (Note: the demo
was written in LV6i.)
0 Kudos
Message 3 of 3
(2,399 Views)