Table Of Contents

Array Controls (G Dataflow)

Version:
    Last Modified: November 30, 2016

    Group data elements of the same type.

    What Is an Array?

    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 to 32 dimensions and as many as (2 31) - 1 elements per dimension, memory permitting. You can build arrays of numeric, Boolean, path, string, waveform, and cluster data types. Input arrays are classified as controls by default and allow users to input data into the control. Output arrays are classified as indicators by default and display data on the panel.

    When Should I Use an Array?

    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.

    How Do I Find an Array Element?

    To locate a particular element in an array, you must use indexes. Each dimension in the array has an index. Indexes let you navigate through an array and retrieve elements, rows, columns, and pages from an array on the diagram.

    spd-note-note
    Note  

    Array indexes are zero-based. The index of the first element in the array, regardless of its dimension, is zero.

    How Do I Create a Multidimensional Array?

    Specify Dimensions on the Item tab to define the dimension or size of the array.

    How Do I Manipulate Array Data?

    On the diagram, use the array nodes to manipulate data. Some of the tasks you can complete with the array nodes include:
    • Extracting individual data elements from an array.
    • Inserting, deleting, or replacing data elements in an array.
    • Splitting arrays.

    You can use the Build Array node or a loop to build an array programmatically.

    An example of a simple array is a 1D text array that lists the eight planets of our solar system in order.

    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 to n - 1, where n is the number of elements in the array. For example, n = 8 for the eight planets, so the index ranges from 0 to 7. Earth is the third planet, so it has an index of 2.


    Recently Viewed Topics