variableMatrix¶
Collect one or more variables into a separate matrix table, and return the name of the table.
This is useful for extracting variables that will be used in matrix multiplications.
variableMatrix(
varName1,
[varName2,]
[…]
)
Arguments¶
varName1- The name of a variable in the projection node. This may be the name of a scalar (constant) or a time vector (proj).
varName2, …- More variable names. Optional.
Examples¶
See the example workbook.
Time vectors¶
Say the current projection node has the following results in the time vectors table (ProjArea):
| t | VarA | VarB | VarC | VarD |
|---|---|---|---|---|
| 1 | 11 | 12 | 13 | 14 |
| 2 | 21 | 22 | 23 | 24 |
| 3 | 31 | 32 | 33 | 34 |
| 4 | 41 | 42 | 43 | 44 |
| 5 | 51 | 52 | 53 | 54 |
We may use the variableMatrix() function to get a new matrix table containing only the variables we want, and in the
order we want:
variableMatrix("VarA", "VarD", "VarB")
This will create a table in the output workbook for this projection node that looks like this:
| VarA | VarD | VarB |
|---|---|---|
| 11 | 14 | 12 |
| 21 | 24 | 22 |
| 31 | 34 | 32 |
| 41 | 44 | 42 |
| 51 | 54 | 52 |
Scalars¶
Say the current projection node has the following results in the scalars table (Constants):
VarE=6VarF=7VarG=8VarH=9
We may use the variableMatrix() function to get a new matrix table containing only the variables we want, and in the
order we want:
variableMatrix("VarH", "VarF", "VarG")
This will create a table in the output workbook for this projection node that looks like this:
| VarH | VarF | VarG |
|---|---|---|
| 9 | 7 | 8 |
Note that there is only one row, because all the variable in the matrix are scalars.
Time vectors and scalars combined¶
Time vectors and scalars may be combined, e.g.:
variableMatrix("VarA", "VarE", "VarC")
This will create a table in the output workbook for this projection node that looks like this:
| VarA | VarE | VarC |
|---|---|---|
| 11 | 6 | 13 |
| 21 | 6 | 23 |
| 31 | 6 | 33 |
| 41 | 6 | 43 |
| 51 | 6 | 53 |
Note that the scalar VarE is repeated to match the number of rows dictated by the time vectors.