Example Code

Updating 2D Boolean Array During Run-Time 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.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This VI demonstrates how to see changes in an array while the VI is running.

 

Description

This VI compares two methods of accumulating 2D Boolean arrays.

The non-updating array simply receives a true constant wired out of two auto-indexed For Loops. While this may be the easiest way to accumulate our 2D array, we cannot see the LEDs in the array update during run-time since the indicator can only update once both loops have finished executing.

The updating array uses Insert Into Array blocks and shift registers to accumulate an array that can be updated inside the inner-most loop. Using this method, any changes made to the array can be seen during run-time.

Note: The auto-indexing wires which are fed into the For Loops only exist in order to force the loop count to be the exact size of the array. They are not used to pass data into the array.

 

Requirements

  • LabVIEW 2013 (or compatible)

 

Steps to Implement or Execute Code

  1. Run the VI.
  2. Observe how the lights change

 

Additional Information or References

VI Snippet of Block Diagram

sni.png

 

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

 

David H.
National Instruments

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