Defining Vectors and Matrices Using Data Elements

Once you have defined the sets of array labels A collection of labels identifying the items of an array. that you wish to use, you can create vectors and matrices. The primary way to create vectors and matrices is to define them using Data elements. Once these exist, other vectors and matrices can be created by other kinds of elements based on these (e.g., by using these as inputs).

You specify that a Data element An input element intended to represent constant inputs in a model. is to be a vector A one-dimensional array. or a matrix A two-dimensional array. when you define its output attributes Three properties of an element's output that determine the kinds of inputs to which it can be linked: type, order and dimensions. (by pressing the Type... button in the element's properties dialog). The dialog for specifying output attributes for an element looks like this:

The Order drop-list provides three choices: "Scalar" (the default), "Vector (1D-Array)", and Matrix (2D-Array)".

If you wish to create a vector, select "Vector (1D-Array)". If you wish to create a matrix, select "Matrix (2D-Array)". If you select "Vector (1D-Array)", the Row Labels field becomes available. If you select "Matrix (2D-Array)", both the Row Labels and Column Labels fields become available. These two fields contain lists of all of the sets of array labels defined in your model:

If you have defined the Order as a vector or a matrix (i.e., if the Row Labels or Column Labels fields are active), you must select a set of array A collection of variables that share common output attributes and can be manipulated in GoldSim elements or input expressions. labels (or GoldSim will display a warning message when you try to close the Output Attributes dialog).

Note that within the drop-list for the Row and Column labels is the choice to "Create new Array Labels...". If you click this option, the dialog for defining new array labels will be displayed. After leaving the Array Labels dialog, you will be returned to the dialog for defining output attributes.

To illustrate how you would create a vector or a matrix Data element, consider the following example. Suppose that you defined the Order as "Vector (1D-Array)", and defined the Row Labels as "Days". The properties dialog for the Data element would look like this.

Note that this dialog is different from the standard Data element dialog for a scalar An output consisting of a single value or condition..

In particular, because it is an array, you cannot directly edit the Data input field. To edit the vector, you must press Edit Data..., which will display the following dialog.

This dialog displays all items of the vector (in this case, seven). Each field is a standard edit field (you can enter a number, an expression or a link), although typically you would enter just a number (with units).

Note that the equivalent dialog for a matrix looks like this (in this example using a set of array labels for the Column Labels named Fruit with members Apples, Oranges, Peaches and Pears):

Although you would often enter constants (numbers) into the input fields defining a vector or a matrix, the fields accept links and expressions. For example, you could create a vector of Stochastics by entering a link to a Stochastic for each item in a vector. In fact, this is the only instance when it is recommended that you enter links when defining a Data element (you should not do so for scalar Data elements).

Note: You can paste data from a spreadsheet, a Word table, or a tab-delimited text file directly into a vector or matrix grid. To do so, copy the data to the clipboard, select the cell in the vector or matrix representing the upper left-hand corner of the range into which you wish to paste (by single-clicking in it), and press Ctrl+V.
Note: You can resize the columns of the editing dialog by dragging the lines separating columns right or left. You can also resize the entire dialog by dragging a side (or a corner).