Case Structure

From LabVIEW Wiki

Jump to: navigation, search

Contents

Introduction

A case structure is a LabVIEW primitive that dynamically selects which parts of code should execute. CaseStructure.PNG

General Items

On compile time the compiler assures that at least one case will run when the code executes, if this cannot be determined the containing VI will be Broken. To provide a case for values of the selector that is general a case can be labeled default. One case can be used to handle several selector values. To enter these provide a , (comma) between the values. A range of these values can be set by providing .. (two dots) between the values.

Editing tips and tricks

Selection mechanism

The selection decision of the case structure can be done by several datatypes:

Boolean

The boolean case structure is the default state of the case structure. It has a case for the True and the False state.

BooleanCase.PNG

Integer

The integer case structure uses the integer value of the selector data type to determine which case is executed

IntegerCase.PNG

Floats

Non-integer numerics (floats) are rounded according to IEEE 754-1985, where a non-integer is rounded to the nearest even integer if it's rest is .5 .

Tricks

Example of radix in case structure.png

BinaryCaseSelect.png

Enum or Tab control

The Enum case structure uses the string interpretation of the value to label the cases.

EnumCase.PNG

Tricks

String

The string case structure uses the string value to select which case should execute.

StringCase.PNG

Tricks

Caveats for using ranges

Error

The error case structure is like the boolean case structure but can be controlled by the error state of an Error cluster. The border of the error case is red and the non-error case is green.

ErrorCase.PNG

Error Case Structure.png

Personal tools
Namespaces
Variants
Actions
Navigation
interaction
Toolbox