Understanding Array Labels

When you define a vector or a matrix, it must be defined relative to a particular set of array labels. A set of array labels is simply a collection of labels for the items of the array. The labels can be numbers (1, 2, …, 10) or words (apples, oranges, peaches, pears). When you define an element which has an array as an output, you must specify the sets of array labels upon which the array is based.

You define and reference a particular item of an array by using these labels. Vectors require a single set of array labels, and matrices require two sets of array labels (one for the rows, one for the columns).

As an example, consider a matrix that represents the salmon population in each of a number of streams over a period of 3 years:

The matrix is defined relative to two sets of array labels: the rows are labeled using a "stream" set, and the columns are labeled using a "year" set. The labels or members for the "stream" set are BearCreek, IssaquahCreek, BlackRiver, and so on. The labels for the "year" set are the numbers 1998, 1999, and 2000.

You would reference the (scalar) item in the third row and second column of the matrix as Salmon_Population[BlackRiver, 1999].

Related Topics…

Learn more about: