Structures in LabVIEW

Laboratory Virtual Instrument Engineering Workbench (LabVIEW) is a design platform developed by National Instruments. It uses a visual programming language named 'G' that helps the developers in graphically building the systems. The text-based code is replaced by graphical icons. The systems are built with a combination of software and hardware. The developers can add hardware and represent complex logic on the diagram. Structures are important while building complex logic for the diagrams. In this post, you will learn about various structures available in LabVIEW. You can also get to know how to use these structures.

Structures in LabVIEW

The structures in LabVIEW contain sections of graphical code. They control and determine when and how the code should be run in a virtual instrument (VI). A structure can be referred to as a graphical representation of a loop. It helps in iterating a piece of code as many times as we want.

How to access structures in LabVIEW?

Open LabVIEW, and open the Front Panel. Click on the 'View' option from the top menu and select 'Functions'. Choose the 'Programming' option and click on the 'Structures' icon. You will get a list of all the structures of LabVIEW. To use a structure, drag and drop them on to the block diagram.

Types of structures in LabVIEW

LabVIEW offers different kinds of structures that serve different purposes. Here is the list of structures that are available in LabVIEW.

  • While Loop structure
  • For Loop structure
  • Sequence structure
  • Flat sequence structure
  • Stacked sequence structure
  • Event structure
  • Timed structure
  • Diagram disable structure
  • Conditional disable structure

Let's discuss in detail each of these structures and how to implement them.

While Loop structure

The While loop is very much similar to the Do While loop we have in any text-based programming language. It executes a piece of code (a subdiagram) until a stop condition occurs. The While loop executes at least one time. It is mostly used to keep a program running until a user clicks on the stop button.


When you want to place a subdiagram in a while loop, select the While loop from the Structures palette. You will get a cursor through which you can drag a selection rectangle around the diagram that you want to repeat. Once you release the cursor, you can observe a While loop boundary around the section that you selected. Then, you can proceed and add any block diagram objects that you want to the loop. The iteration terminal on the loop is the output terminal, and it stores the number of iterations that are complete. The iteration count in the iteration terminal always starts with 0.

For Loop structure

A Foor loop iterates for a specific number of times. It executes the subdiagram within the block for n time, where n is the value wired to the count terminal. The count terminal is the input terminal that indicates how many times to repeat the subdiagram. The iteration terminal on the loop is the output terminal that indicates the current loop iteration count. The iteration count always starts at 0 and it ranges from 0 to n-1


A For loop might not execute sometimes in a VI when the condition is not met. We can change a While loop to a For loop. To do so, right-click on the border of the While loop and select the 'Replace with For Loop' option from the shortcut menu.

Sequence structure

A sequential structure is used when a subdiagram should be executed in a linear process or a sequential order. Most of the calculations in LabVIEW might execute in a parallel fashion. So these calculations are forced to follow a sequential order from left to right. This way, we will have control over the order of execution.

A sequential structure is especially used when the next calculation is dependant on the current input. The output tunnel can have only one data source and the output can come from any frame. There are two types of sequence structures.

  • Flat sequence structure
  • Stacked sequence structure

Labview Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

Flat sequence structure

The flat sequence structure is used to execute frames from left to right. The data values to the frames have to be wired properly. When a frame execution is complete, the data leaves the frame. The input of one frame might depend on the output of the previous frame.


A flat structure is very flexible. When a frame is added or deleted, it will resize automatically. We can change a flat sequence to a stacked sequence. If we do that, all the input terminals of the frames will be moved to the first frame of the stacked sequence. When we change the stacked sequence to a flat sequence, we have to move the wires of the first frame to their original locations, i.e., individual frames.

Stacked sequence structure

In a stacked sequence structure, all the frames are stacked together to look like a single frame. So you can only see one frame at a time. It many reduces the space, so you will have more room on the block diagram. It starts the execution from frame 0. To pass data between the frames, we have to use sequence locals. It returns the output data after the last frame executes.


To rearrange the frames or to navigate through the frames, we have to use the sequence selector identifier. It always shows the currently executing frame and also the range of frames. The frame label in a stacked sequence structure contains frame number at the center with decrement and increment arrows on each side. When we add a frame to the stacked sequence structure, the frame label automatically adjusts the numbers.

Event structure

An event structure contains one or more subdiagrams. When an event occurs, it handles the event and executes the appropriate case. The event structure waits for an event for a specific time, and it then time-outs. We have to wire a timeout terminal to the left of the event structure and specify the number of milliseconds for the event structure to wait for an event. The default timeout value is -1, which indicates never to timeout.


As an event structure can have multiple cases or subdiagrams, only one case can occur at a time. If you want to handle multiple events, place the event structure in a While loop. A case in an event structure cannot handle both notify and filter events.

Subscribe to our youtube channel to get new updates..!

Timed structure

A timed structure can contain one or more subdiagrams (or frames) that execute sequentially based on an internal or external timing source. It executes a frame only once and does not repeat iterations. When we want to design a VI that executes only once at a precise time or execution feedback, we can use a timed sequence structure.


Each frame in a timed structure contains input nodes, output nodes, and data nodes on the left and right sides of the frame. The nodes of the timed structure do not show the input and output terminals by default. We have to resize the frame to take a look at node terminals.

Diagram disable structure

A diagram disable structure is used to disable a section of the diagram that we don't want to execute. It's like commenting out a piece of code in a text-based programming language. Place the diagram disable structure around the subdiagram that we want to disable. Once the structure is added, we can add, duplicate, rearrange, or delete the subdiagrams.


There will be a selector label through which we can scroll through the subdiagrams in the diagram disable structure. We can also remove the structure without removing the subdiagrams in it.

Conditional disable structure

When we have some subdiagrams to execute depending on a condition, we can use a conditional disable structure. We can disable a subdiagram on the block diagram, so it executes based on a user-defined condition. Place a conditional disable structure on the block diagram, and add a subdiagram to it. Right-click on the border of the structure and select the 'Edit Condition For This Subdiagram' option.


We will get a configure condition dialog box where we can configure conditions. It also provides pre-defined symbols to configure conditions. We will have a selector label to scroll through the available subdiagrams in the structure. When we delete the structure, the subdiagrams won't get deleted.

Labview Training

Weekday / Weekend Batches


In this post, we have explained in detail about all the structures in LabVIEW. Using structures will make the programming easy for developers. LabVIEW has introduced them, so the developers can execute the subdiagrams according to their needs. Try out different structures in the development of VI in LabVIEW.


Request for more information

Kavya Gowda
Kavya Gowda
Research Analyst
Kavya works for HKR training institute as a technical writer with diverse experience in many kinds of technology-related content development. She holds a graduate education in Computer science and Engineering stream. She has cultivated strong technical skills from reading tech blogs and also doing a lot of research related to content. She manages to write great content in many fields like Programming & Frameworks, Enterprise Integration, Web Development, SAP, and Business Process Management (BPM). Connect her on LinkedIn and Twitter.

To Top