LabVIEW Basics - 10 | For Loops

For loops allow portions of an application to execute repeatedly. For loops are commonly used to iterate over data sets or perform an operation a fixed number of times.

Prerequisites

Hardware


None.

Software

Procedure




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

  • The Count Terminal determines how many times the code inside the loop will execute.
    • The Count is tested before each iteration of the loop. Therefore it is possible that the code inside the loop may never execute (if the count is less than or equal to 0).

  • The Iteration Terminal provides the current loop count starting with zero.

  • By default for loops execute as quickly as possible. Use the Wait (ms) or a similar primitive to control execution speed.

  • Multiple for loops will be distributed across multiple CPU cores automatically.