Until now, we've dealt with scalar numbers only (a scalar is simply a data type that contains a single value, or "non-array"), and now it's time to move onto something more powerful and compound. A LabVIEW array is a collection of data elements that are all the same type, just like in traditional programming languages. An array can have one or more dimensions, and up to 231-1 elements per dimension (memory permitting, of course). An array data element can have any type except another array, a chart, or a graph. Array elements are accessed by their indices; each element's index is in the range 0 to N-1, where N is the total number of elements in the array. The one-dimensional (1D) array shown here illustrates this structure. Notice that the first element has index 0, the second element has index 1, and so on.
You will find that waveforms (and many other things) are often stored in arrays, with each point in the waveform comprising an element of the array. Arrays are also useful for storing data generated in loops, where each loop iteration generates one element of the array. |