Example Code

Create Cluster (Scripting) Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • LabVIEW

Code and Documents



This VI will create a cluster out of selected controls in the user VI



Scripting in LabVIEW gives you an access to a great deal of options for controlling and modifying LabVIEW code. VI Scripting enables users to write a LabVIEW program that can generate and inspect LabVIEW code. It exposes many additional VI Server classes, properties, and methods. It allows you to create new VIs, Front Panel controls, Block Diagram objects and wires as well as traverse diagram object hierarchies and modify code. In this example, a given script will take all the user VI selected controls and bundle them into a cluster. The user need to make sure to select the controls he wants clustered, while specifying the VI he is currently editing, so that the script knows which VI to reference.

For more information on scripting see the Developer Zone Community: LabVIEW Scripting.



LabVIEW Full Development System 2012 or compatible


Steps to Implement or Execute Code

  1. Select the controls you want clustered
  2. Specify the VI you are currently editing by providing VI Path
  3. Run the VI


Additional Information or References

VI Block Diagram

Create Cluster BD 1.jpg


Create Cluster BD 2.jpg

In order to create your own scripts, start here.


**This document has been updated to meet the current required format for the NI Code Exchange. **


Dan King

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.