Dynamically Build a Simple Array

製品と環境

このセクションは、サンプルの作成に使用された製品およびOSを反映します。

以下に示された製品を含め、NIのソフトウェアをダウンロードするには、ni.com/downloadsをご覧ください。

    ソフトウェア

  • LabVIEW

コードとドキュメント

添付

Overview

 

Arrays are used to store data in a new and organized fashion. Someimtes they can be a a little tricky to manipulate to get just the way you want them to be. One solution is to make an array of a set size and fill in the values. While this process helps with memory allocation, it does not help us with creating an array that we do not know the size of. This is a simple example that should how to create an array dynamically.

 

Description

 

This example uses a shift register, build array and the random number generator to create a 3x8 array. The first collumn is a random number, the second clumn in the interation count and the third colum is a constant. There is a Wait Until Next ms Multiple timer in there to slow down the excution. This VI can be implimented with a While Loop instead of a For Loop.

 

Steps to Impliment and Execute

 

1) Download the VI

2) Observe the block diagram. Notice how the shift register is connected to the build array.

3) Run the VI and observe how it fills the array collumn by collumn

 

Requirements

 

LabVIEW 2010 or later to run VI

LabVIEW 2012 for code Snippet

 

Block Diagram Code Snippet

Dynamically Build Array.png

Kurt P
Automated Test Software R&D

NIコミュニティのサンプルコード交換のサンプルコードは、MIT Licenseによりライセンス供与されています。