Contents - Index
EES allows the use of array variables. EES array variables provide the array index in square brackets, e.g., X and Y[6,2]. In most ways, array variables are just like ordinary variables. Each array variable has its own guess value, lower and upper bounds and display format. However, simple arithmetic operations are supported for array indices so that the use of array variables can be more convenient in some problems. The Insert/Modify Array command provides an easy way to enter the values of an array. A detailed discussion of the use of array variables appears in Chapter 7 of the manual. Array range notation can be used to simplify passing of array variables to functions and procedures.
The index value of an array can be any one of the following:
i) a numerical quantity or expression
ii) an EES variable that has been set to a value with the array reference
iii) an EES variable that is set to a value in the Parametric table
iv) the TableRun# keyword.
A convenient shorthand method for entering multiple array values uses Array Range Notation as follows:
X[1..4] =[22, 33, Z^2, a*b]
is equivalent to entering
Array variable may be used in the Main program, as well as in EES internal functions, procedures, subprograms and modules. A The values of all variables including array variables are normally displayed in the Solution window after calculations are completed. A separate solution window is provided for each function, procedure, subprogram and module. However, array variables may optionally be displayed in a separate Arrays table window, rather than in the Solution window. Similar to the Solution window, a separate tabbed Array table is provided for each function, procedure, subprogram and module, as well as for the Main program. Displaying the arrays in the Arrays table not only makes it easier to view the data, but it also allows the array variables to be plotted or copied to a spreadsheet program.
By default, arrays do not appear in the Arrays table window for functions procedures, subprograms of modules. To have the array variables in these program elements appear in an Arrays table, include a $ARRAYS ON directive within the equations for the program element. Use the $ARRAYS OFF directive to restore the display to the default behavior in which the array variables are displayed in the Solution window. The default behavior for the Main program is controlled with the Use Arrays window check box in the Preferences dialog of the Options menu. If this option is selected, the Arrays table will automatically be produced after calculations are completed. Alternatively, the default behavior can be changed by placing a $ARRAYS ON/OFF directive within the Main program.
The first time the Arrays table is created for any program element , the columns in the table are arranged in alphabetical order with the array index value in the first column. Any new array variables that are introduced into the problem are added at the right of the table. Consequently, the columns may not appear in alphabetical order. Clicking the Sort button at the upper left of the table will rearrange the columns to be in alphabetical order.
When there are many columns in the Arrays table, the columns of particular interest may be difficult to find. There are several options to make the process of locating the important columns easier. In addition to placing the columns in alphabetical order with the Sort button, a column can be moved to any location by right-clicking on the column name and changing the column position number. The column position can also be changed by dragging the column header cell (i.e., the cell at the top of a column) to a new location. The background color of a column can be changed. A yellow background, for example, makes the column stand out and therefore easy to find. Columns that are not of interest can be hidden by right-clicking on the column name and then changing the format style to hidden. The column order and color choices are saved with the EES problem information. A hidden column can be restored by changing the format style in the Variable Information dialog window.
The values in any Arrays table may be plotted using the New Plot Window or Overlay Plot command in the Plot menu. Part or all of the data in the Arrays window can be copied to another application by selecting the data followed by the Copy command in the Edit menu. Data in the table can be copied in the same manner as for the Parametric table. If you wish to include the column name and units along with the numerical information in each column, use the Copy Table with Headers command instead of the Copy command.
Array variables are similar to other EES variables. However, it is possible to change a characteristic of all array variables at once. If the Arrays table is visible, right-click in the header cell to bring up the Format Arrays Table dialog for the specified column. If the units of all variables in the array are identical, those units will be displayed in the Units box as shown in the figure on the left. If the units for the array elements are not all the same, the Units box will display 'mixed', as shown in the figure on the right. In either case, the units of all elements in the array, as well as their alternate units and display format digits and style can be changed by editing the fields in the this dialog.
The array name and all array characteristics (e.g., guess value, bounds, display format, and units) can also be changed or viewed in the Variable Information dialog window. If the Show Array Elements checkbox in the Variable Info dialog is de-selected, then only the parent names of the arrays, e.g., X[ ] are shown. Any changes made to the parent array are applied to all elements in the array.
Note: EES saves every variable that you introduce. Using Arrays, it is possible to introduce many variables that you later do not wish to use. For example, if you originally start a problem using array X with 500 subscripted variables and then later change the name to Y, EES will maintain all of the information for both variables X and Y. In this way, it is easy to exceed the maximum number of allowable variables, which is 6,000 for the Commercial version and 12,000 for the Professional version. The 64-bit version provides an upper limit of 24,000 variables. However, you can purge unused variables with the Purge Unused Variables command in the Options menu.
In the Professional version, all tables are equipped with a control to automatically resize the column widths. The control appears as a left-right arrow icon in the upper left cell of the table, as shown below. Clicking the icon causes all of the columns to be adjusted to a width that is just large enough to display all of the information the column. Clicking the icon again returns the column widths to their original values. If the Ctrl key is depressed when the icon is clicked, the column widths will be set to their default values.