# Working With Two-Dimensional Arrays

Working with two-dimensional arrays involves the same basic process as working with one-dimensional Arrays. The only wrinkle is that instead of using one Dimension within the arrayed variable, you will be working with two. For example, suppose that in your model you need to represent Employees both by where they are located (e.g. Boston, Chicago, and Los Angeles) and by the function that they perform within the organization (e.g. Administration, Human Resource, or Finance). The matrix in Figure 11-9 gives a picture of the type of situation that can be captured by a two-dimensional arrayed variable.

Figure 11-9 Two-Dimensional Matrix - Employees

1. Use the Array Editor to define two or more dimensions

When you are ready to set up a two-dimensional Array, the first step is to revisit the Array Editor dialog to define Dimension Names (See Figure 11-3 for details on setting up a Dimension). To set up a two-dimensional Array, you need at least two Dimensions within your model.

2. Transform model variables into arrayed variables

The arrayed variables need to be defined with two Dimensions. To create a 2-D arrayed variable, open the variable's equation dialog and check the Array check box. Then, pick 2-D from the adjacent pop-up list. Finally, use the two dimension name lists to pick the appropriate dimensions for the arrayed variable. Figure 11-10 illustrates how to set up a two-dimensional arrayed stock.

3. Define the equation logic for arrayed variables

As with one-dimensional Arrays, when Apply To All is checked, the constant or algebraic definition you supply once will apply to all elements within the arrayed entity. Figure 11-10 details this process. When Apply To All is not checked, you must work your way through the columns (Dimension 1) and rows (Dimension 2) of the matrix to assign unique values or equations to each element within the arrayed variable. Figure 11-11 illustrates this process.

Figure 11-10 Defining Logic of Two-Dimensional Arrays - Apply To All Checked

Figure 11-11 Defining Logic of Two-Dimensional Arrays - Apply To All Not Checked

Whenever your arrayed variable has arrayed required inputs (or if you initialize a stock using arrayed allowable inputs), defining the equation logic involves an additional step. When you click on the input name to move it to the equation, a secondary dialog will appear. Figure 11-12 illustrates the process of defining a variable using a two-dimensional arrayed input variable.

Figure 11-12 Defining Logic Using Two-Dimensional Arrayed Input Variables - Apply To All Checked

When Apply To All is not checked, use the paging arrows to navigate through each element in the arrayed variable and enter a unique value for each.

More detail on the secondary dialog for a two-dimensional Array is found in Figure 11-13.

Figure 11-13 Secondary Define Dialog - Two-Dimensional Arrays