Initialize array, Initialize array -10 – National Instruments BridgeVIEW User Manual

Page 292

Advertising
background image

Chapter 14

Arrays, Clusters, and Graphs

BridgeVIEW User Manual

14-10

© National Instruments Corporation

Build Array function (Functions»Array)—You can use it to create an
array from scalar values or from other arrays. Initially, the Build Array
function appears with one scalar input.

You can add as many inputs as you need to the Build Array function, and
each input can be either a scalar or an array. To add more inputs, pop up on
the left side of the function and select Add Element Input or Add Array
Input
. You also can enlarge the Build Array node with the Resizing cursor
(place the Positioning tool at the corner of an object to transform it into the
Resizing cursor). You can remove inputs by shrinking the node with the
Resizing cursor, or by selecting Remove Input.

The following illustration shows two ways to create and initialize arrays
with values from block diagram constants. On the left, five string constants
are built into a 1D array of strings. On the right, three groups of numeric
constants are built into three, 1D numeric arrays. Then, the three arrays are
combined into a 2D numeric array. The result is a 3 x 3 array with the rows
3, 4, 7; –1, 6, 2; and 5, –2, 8.

You also can create an array by combining other arrays along with scalar
elements. For example, suppose you have two arrays and three scalar
elements that you want to combine into a new array with the order array 1,
scalar 1, scalar 2, array 2, and scalar 3.

Initialize Array

Use this function to create an array whose elements all have the same value.
In the following illustration, this function creates a 1D array.

The element input determines the data type and the value of each element.
The dimension size input determines the length of the array. For example,

Array of

Strings

2D Array

of Numbers

Advertising