Table Of Contents

Creating a SubVI from a Section of Existing Code

Last Modified: November 26, 2019

  1. Select the section of code you want to reuse.
  2. Click Edit» Create subVI from selection to generate a new .gvi file in the project. To open this file, double-click the corresponding subVI node that contains the section of code you selected. The subVI diagram and connector pane include inputs and outputs for every wire that enters and exits the section of code. The panel automatically includes the corresponding controls and indicators.

    To disable automatically placing items on the panel, click File» Preferences , select the VI tab, and disable Place items on the panel when creating subVI from selection.

  3. Rename and save the new .gvi file. Choose a name that describes what function the VI performs so that other users can clearly understand any diagram that uses the VI as a subVI.

To add the new subVI as a node on other diagrams, locate the subVI in the Project Files tab and drag it to the diagram where you want to use it.


All instances of the subVI are automatically updated with most changes you make. However, if you remove or rearrange inputs and outputs on a subVI, wires attached to those inputs and outputs break in VIs that call the subVI. Fix the calling VIs by deleting the broken wires and rewiring the updated inputs and outputs.

Recently Viewed Topics