Connexions

You are here: Home » Content » Arrays
Content Actions
Lenses

What is a lens?

Lenses

A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual Connexions member, a community, or a respected organization.

This content is ...
Affiliated with (?)
This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • This module is included in aLens by: National InstrumentsAs a part of collection:"LabVIEW Graphical Programming Course"

    Comments:

    "A full introductory course on programming with LabVIEW."

    Click the "National Instruments" link to see all content affiliated with them.

    National Instruments
Also in these lenses
  • This module is included inLens: Connexions Books Available for Print on Demand
    By: ConnexionsAs a part of collection:"LabVIEW Graphical Programming Course"

    Comments:

    "This book is available through the Connexions beta version of print-on-demand from online materials."

    Click the "Printable Books" link to see all content selected in this lens.

    Printable Books
Tags

(?)

These tags come from the endorsement, affiliation, and other lenses that include this content.

Arrays

Module by: National Instruments

Summary: In this section, you will learn about arrays.

Arrays group data elements of the same type. An array consists of elements and dimensions. Elements are the data that make up the array. A dimension is the length, height, or depth of an array. An array can have one or more dimensions and as many as 231-1 2 31 1 elements per dimension, memory permitting.
You can build arrays of numeric, Boolean, path, string, waveform, and cluster data types. Consider using arrays when you work with a collection of similar data and when you perform repetitive computations. Arrays are ideal for storing data you collect from waveforms or data generated in loops, where each iteration of a loop produces one element of the array.
You cannot create an array of arrays. However, you can create an array of clusters, where each cluster contains one or more arrays. Refer to Clusters for more information about clusters.
Array elements are ordered. An array uses an index so you can readily access any particular element. The index is zero-based, which means it is in the range 0 0 to n-1 n 1 , where n n is the number of elements in the array. For example, if you create an array of the planets in the solar system, n=9 n 9 for the nine planets, so the index ranges from 0 0 to 8 8. Earth is the third planet, so it has an index of 2 2.

Creating Array Controls and Indicators

To create an array control or indicator as shown in Figure 1, select an array on the Controls>>All Controls>>Array & Cluster palette, place it on the front panel, and drag a control or indicator into the array shell. If you attempt to drag an invalid control or indicator such as an XY graph into the array shell, you are unable to drop the control or indicator in the array shell.
Figure 1: 1. Index Display, 2. Element Display
You must insert an object in the array shell before you use the array on the block diagram. Otherwise, the array terminal appears black with an empty bracket.

Two-Dimensional Arrays

A 2D array stores elements in a grid. It requires a column index and a row index, both of which are zero-based, to locate an element. Figure 2 shows a 6 6-column by 4 4-row 2D array, which contains 6×4=24 6 4 24 elements.
Figure 2
To add dimensions to an array one at a time, right-click the index display and select Add Dimension from the shortcut menu. You also can use the Positioning tool to resize the index display until you have as many dimensions as you want. Figure 3 is an example of an uninitialized 2D array control.
Figure 3

Creating Array Constants

You can create an array constant on the block diagram by selecting an array constant from the Functions>>All Functions>>Array palette, placing it on the block diagram, and dragging a constant into the array shell. Array constants are useful for passing data into a subVI.

Comments, questions, feedback, criticisms?

Discussion forum

Send feedback