LabVIEW Basics - 12 | Case Structures

Case structures can be used to selectively execute code based on the value of a condition.

Prerequisites

Hardware


None.

Software

Procedure




  • To place a case structure, select it from Functions Palette┬╗Structures then click and drag on the block diagram to draw a box.

  • Case structures contain sub diagrams or cases.

  • The value passed into the Case Selector terminal determines which case executes.
    • By default the case selector is a boolean data type and two cases exist True and False
    • Connecting another data type to the case selector will automatically change it's data type.

  • The Selector Label indicates the condition associated with each sub diagram.
    • Left click the selector label to change the condition associated with a sub diagram.

  • Add or remove sub diagrams by right clicking the edge of the case structure or selector label.
  • Data is passed into and out of the case structure using tunnels which are automatically created when data is wired into or out of the case structure.