It takes two steps to make the controls and indicators for compound data types like arrays and clusters. You create the array control or indicator by combining an array shell with a data object, which can be numeric, Boolean, path, or string (or cluster, but we'll cover that later). You will find the array shell in the Modern>>Array, Matrix, & Cluster subpalette of the Controls palette (see Figure 7.1). Figure 7.1. Array shell
To create an array, drag a data object into the element display window. You can also deposit the object directly by clicking inside the window when you first choose the object from the Controls palette. The element display window resizes to accommodate its new data type, as shown in Figure 7.2, but remains grayed out until you enter data into it. Note that all elements of an array must be either controls or indicators, not a combination. Figure 7.2. Front panel showing an empty array shell (A) and three populated array shells (B)When you first drop an array shell on the front panel, its block diagram terminal is black, characteristic of an undefined data type. The terminal also contains brackets (when View As Icon terminal option disabled) or an array icon (when View As Icon is enabled), shown in part (A) of Figure 7.3, which are LabVIEW's way of denoting an array structure. When you assign a data type to the array (by placing a control or indicator in its element display window), then the array's block diagram terminal assumes its new type's color and lettering, as in part (B). You will notice that array wires are thicker than wires carrying a single value. Figure 7.3. Block diagram showing empty (A) and populated (B) array shell terminalsYou can enter data into your array as soon as you assign a data type to it. Use the Labeling or Operating tool to type in a value, or if your data is numeric, click the arrows of the index display to increment or decrement it. If you want to resize the array element object, as shown in Figure 7.4, use the Positioning tool and make sure it turns into the resizing handles when you place it on the edge of the object (you will probably have to position it slightly inside the array shell, and you may have to move it around a bit to get the object inside the array shell to show the resizing handles). If you want to show more elements at the same time, as shown in Figure 7.5, move the Positioning tool around the edge of the array shell until the array shell shows the resizing handles, then stretch either horizontally or vertically (your data is unchanged by the layout of your array). You will then have multiple elements visible. The element closest to the index display always corresponds to the element number displayed there. Figure 7.4. Resize array element
Figure 7.5. Resize array shell
You can create array constants on the block diagram just like you can create numeric, Boolean, or string constants. Choosing Array Constant from the Array subpalette of the Functions palette will give you an array shell; then simply place in an appropriate data type (usually another constant) just like you do on the front panel. This feature is useful when you need to initialize shift registers or provide a data type to a file or network function (which you'll learn about later). If you want to clear an array control, indicator, or constant of data, pop up on the index display (NOT the element itself or you'll get the wrong menu) and choose Data Operations>>Empty Array. If you want to insert or delete an element from an array control, indicator, or constant, pop up on an element of the array and choose Data Operations>>Insert Element Before or Data Operations>>Delete Element. Array ScrollbarsWhile changing the value in the index display allows you to change the array elements that are visible in the array shell, it is probably easier and more intuitive to use array scrollbars (see Figure 7.6). You can make the array shell scrollbars visible by right-clicking on the array shell and selecting Visible Items>>Vertical Scrollbar or Visible Items>>Horizontal Scrollbar from the shortcut menu. Figure 7.6. Array scrollbars
|