LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to create subvi include local variable?

Now I want to know how to create a subvi in labview?(This Vi include one or two local variable)
0 Kudos
Message 1 of 2
(2,362 Views)
There is no difference between the creation of a subVI or regular VI. You go to File>New VI. It becomes a subVI if you call it from another VI. If you have code in a main VI that you want to make into a subVI, highlight the code and go to Edit>Create subVI. You cannot include a local variable from the main VI in your subVI. By definition, a local variable only is available to the VI in which it resides. If you want to pass values to the main from a subVI, you could use a Global variable. Use either the normal one on the Structures palette or use a functional-style global. There are plently of references to this type of global in the shipping documentation and on the forum but it is basically a subVI with a shift register. Your other alternative is to pass a reference to the control you want to update in the main to the subVI and write to the reference in the subVI. There are also shipping examples on using control references.
0 Kudos
Message 2 of 2
(2,351 Views)