Home > Support > NI Product Manuals > LabVIEW Communications System Design Suite 1.0 Manual

A subVI is a VI that contains reusable code and simplifies a diagram. You can call a subVI from other VIs within the same project. SubVIs are analogous to functions or subroutines in other programming languages.

When you add an instance of a subVI to another VI, the subVI appears as a single node on the diagram of the other VI, similar to a node from the palette. When data in the calling VI reaches the subVI node, LabVIEW executes the diagram of the subVI.

The following diagram shows two common situations that benefit from subVIs.

  1. Users may have difficulty understanding the purpose of this section of code because it performs several operations. The more complex a diagram, the more time it takes to interpret sections of code.
  2. The same code appears in two different places. Repeated code increases the likelihood of errors. For example, if you change one section of repeated code, you must remember to make the same change everywhere the code section occurs.

The following diagram shows two solutions that subVIs provide.

  1. The Flip a Coin subVI represents the highlighted code inside the For Loop of the previous diagram. The subVI simplifies the diagram and communicates the purpose of the code through its label and node icon.
  2. The Percentage subVI represents one of the duplicate sections of highlighted code from the previous diagram. The Percentage subVI performs the same function in two places without repeating code. If you change code in the VI called by the Percentage subVI, both instances of the subVI change.