The index display of a 1D array identifies the left-most visible element.
By default, a new array is a 1D array. The element display shows the single element the index display contains. However, you also can display the array as a table of elements by resizing the array shell.
Complete the following steps to create a 2D numeric array, display it in a table, and use the index displays to alter the display.
- Add an array shell to the front panel window. An array shell includes an index display on the left, an element display on the right, and an optional label.
- If the Controls palette is not already visible, right-click the element display to display the Controls palette.
- Add a numeric control to the array shell.
- Right-click the index display and select Add Dimension from the shortcut menu to create a 2D numeric array in single-element form. A single-element array displays only one element. Keep both index values at 0 for now. The top index refers to rows, and the bottom index refers to columns.
- Move the Positioning tool over one of the four corners surrounding the element in the single-element array. The Positioning tool changes shape and resizing handles appear.
- Use the Positioning tool to resize the element display to add or subtract elements in the array. Resize the array to have two rows and three columns. You also can resize an individual element display. When you resize an element display, all other elements resize to match the one you changed.
- Use the Labeling tool or the Operating tool to assign values to each numeric control in the array. Assign values 1 through 3 to the first row, 4 through 6 to the second row, and so on.
- An index display starts at zero. You use the index display to identify the coordinates of the upper left-visible element. Manipulate the index displays the same way you operate a numeric control. Increment the row and column index controls to see how they specify a particular element in the array. The specified element always appears in the upper-left element display.
Think of a 2D array as a row of columns. The upper display of the two boxes on the left is the row index and the lower display is the column index. The combined display to the right of the row and column displays shows the value at the specified position.
The number of indexes required to locate an item of data determines the dimension of an array.
You operate an element of the array in the same manner as you operate a control or indicator of the same type.