To create an array in G, right click on the Front Panel window and select Array from the Controls >> Modern >> Arrays, Matrix & Cluster menu, and drop the array structure onto the Front Panel window to create an array.
The array structure consists of an index or element offset (highlighted left portion of the array structure) and the array elements (right portion of the structure). When the array structure is placed on the Front Panel window, the data type of the array is undefined as indicated by the grayed out portion of the array.
To define the array data type, drag and drop any data type, such as numeric, Boolean, string or cluster structure, onto the elements portion of the array structure.
At this point, the newly defined array is an Empty or NullArray because no elements of the array have been defined. This is indicated by the grayed out data type within the elements array structure.
To define elements of an input array, select the element’s index and enter the appropriate value. Figure 5 defines a numeric array with one element at index 0.
G arrays are zero-based. The last element index of an N element array is N-1. Figure 6 and Figure 7 are those of a 10 element array.
An output array is created similarly to an input array with the exception that an output data type needs to be dropped into the array structure.
Multidimensional Arrays
To create multidimensional arrays, click on the array’s index and select Add Dimension from the menu.
Figure 10 shows a 2-dimensional array.
Array Operators
Clusters
Clusters allow users to create compound data types by aggregating various and different data types into a single unit.
Select the various data types and drag them onto the cluster structure. Figure 13 shows an Error Cluster consisting of a Boolean Error, a numeric ID and a string Message data types.
No comments:
Post a Comment