LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Basic Question - Whats the equivalent of creating a function (i.e. sub-Vi)?

My labview program is getting unruly so Id like to group a portion of
it and make it into a single vi block. How can I do this?

Also, I've created local variables for some of the controls, I'm
assuming I'll have to change these to global variables in order for
them to be seen across my new VI blocks? I don't see any 'global'
variable option, are they called something else in Labview?

Thanks!
0 Kudos
Message 1 of 2
(2,438 Views)
To automatically create a subVI from some code select the code and then select the Edit->Create SubVI menu item.

The first response you will get on this forum regarding local variables: Are you absolutely certain that you need to use local variables? Local variables are typically a crutch for those who come from a text-based programming language background. In most cases they can be replaced by a simple wire. As for passing data into subVIs you do not need to resort to global variables, although LabVIEW has them. The subVIs have connector panes where you define inputs and outpus, just like the arguments of a function in, say, VB or C.


To learn more about LabVIEW it is recommended that you go through the tutorial and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials.
Message 2 of 2
(2,434 Views)