Example Code

Visually Display and Manipulate Arrays

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
his example displays an array as different coloured pixels in a 2D picture and allows the user to change the individual values.


Description
This example will build a simple 100x100 array of integers between 0 and 2 and display these as different coloured pixels in a 2D picture display. The user then has the ability to change the individual values (or pixel colours) by clicking on each pixel or, alternatively, to change a large group of pixels using a ROI selector.


Requirements

  • LabVIEW 2012 (or compatible)
  • IMAQ/IMAQdx drivers


Steps to Implement or Execute Code

  1. Run the Visual_Array.vi and notice that a randomly generated 100x100 array of 0s, 1s and 2s is generate as 'Original Array';
  2. Use either the pixel selector or ROI selector to change the values of pixels in the 2D picture display. You can select which colour/value to change to using the drop-down menu.
  3. Hit 'Set New Pixels' to write these new values to 'New Array' and notice that the values have changed between Original and New Array.

 

Additional Information or References
VI Block Diagram
half code.png

 

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

 

 

Eden S
Applications Engineer
National Instruments UK & Ireland

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