Reduce repeated operations in a VI by using subVIs or loops to reuse block diagram code.

As you create VIs, you might find that you perform a certain operation frequently. Consider using subVIs or loops to perform that operation repetitively. For example, the following block diagram contains two identical operations.

Block diagram showing the same Convert to C operation duplicated in two places.

You can create a subVI that performs that operation and call the subVI twice, as shown in the following block diagram.

Block diagram that calls the same subVI twice to replace duplicated code.

You also can reuse the subVI in other VIs. You can use a loop to combine common operations.