Creating a SubVI from a Section of Existing Code
- Updated2023-02-17
- 1 minute(s) read
Creating a SubVI from a Section of Existing Code
- Select the section of code you want to reuse.
-
Click
.gvi file in the project.
to generate a new
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.Tip To disable automatically placing items on the panel, click , select the VI tab, and disable Place items on the panel when creating subVI from selection.
-
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.
Note 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.