Table Of Contents

Creating a SubVI from a Section of Existing Code

Last Modified: September 27, 2017

  1. Select the section of code you want to reuse.
  2. Click Edit»Create subVI from selection. This generates a new .gvi file in the project. You can open this file by double-clicking the corresponding subVI node that replaces the section of code you selected. The subVI node includes inputs and outputs for every wire that enters and exits the section of code that was replaced.
  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