Example Code

Programmatically Resizing and Filling an Array in TestStand

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

  • Teststand

Code and Documents

Attachment

Overview

This example demonstrates various methods of using the TestStand expression language to resize arrays and populate all elements of the array with an initial value.

 

Description

TestStand allows you to define array variables which are initially empty. In some cases, you may want to programmatically set the size and dimensions of the array, as well as assign an initial value to all elements of the array. The TestStand expression language includes a set of array functions that can be used to perform these operations.

 

The example demonstrates the following techniques for performing these tasks:

  •  Assigning values to an array using an array literal string.
  • Using the SetArrayBounds() TestStand expression function to set the size of a single or multi-dimensional array.
  • Using the SetElements() TestStand expression function to populate every element of an array with a specified value.

 

Hardware and Software Requirements

Initialize Arrays_NIVerified.zip

TestStand 2010 or Compatible

 

Initialize Arrays Legacy_NIVerified.zip

TestStand 2.0 or Compatible

LabVIEW Development System 5.1.1 or Compatible

 

Steps to Implement or Execute Code

  1. Open the attached sequence file.
  2. The sequence file is organized such that each approach for resizing and filling arrays is located in a separate sequence. Examine each sequence to understand the various approaches and TestStand expression methods being used.
  3. If desired, you can set a breakpoint at the end of each sequence to allow you to examine the value of the array variables after each sequence executes.
  4. To run the example, with the MainSequence selected in the Sequences pane, click Execute » Run MainSequence.

 

Mark M.
Applications Engineering
National Instruments

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

Contributors