Chapter 14 arrays, clusters, and graphs, Arrays, How do you create and initialize arrays – National Instruments BridgeVIEW User Manual

Page 283: Chapter 14, Arrays, clusters, and graphs, Arrays -1, How do you create and initialize arrays? -1, Er 14, Introduces, R 14

Advertising
background image

© National Instruments Corporation

14-1

BridgeVIEW User Manual

14

Arrays, Clusters, and Graphs

This chapter introduces the basic concepts of polymorphism, arrays,
clusters, and graphs and provides activities that explain auto-indexing and
the Graph and Analysis VIs.

Arrays

An array is a collection of data elements that are all the same type. An array
has one or more dimensions and up to 2

31

– 1 elements per dimension,

memory permitting. You access each array element through its index. The
index is in the range 0 to n – 1, where n is the number of elements in the
array. The following 1D array of numeric values illustrates this structure.
Notice that the first element has index 0, the second element has index 1,
and so on.

How Do You Create and Initialize Arrays?

If you need an array as a source of data in your block diagram, you can
choose Functions»Array and then select and place the array shell on your
block diagram. Using the Operating tool, you can choose a numeric
constant, Boolean constant, or string constant to place inside the empty
array. The following illustration shows an example array shell with a
numeric constant inserted into the array shell.

To create an array on the front panel, select Array & Cluster from the
Controls palette and place the array shell on your front panel. Then select
an object (numeric, for example) and place that inside the array shell. This
creates an array of numerics.

10-element array

1.2

3.2

8.2

8.0

4.8

5.1

6.0

1.0

2.5

1.7

0

1

2

3

4

5

6

7

8

9

index

Advertising