# MATRIX

## Description

Microsoft Excel does not provide a natural way to work with concatenating numerical arrays / vectors. The only natural way to do this in Microsoft Excel is to input or display vectors adjacent to another within a worksheet.&#x20;

This restriction can force copying and replicating vectors into new or existing sheets when constructing more complex workbooks that require references to matrix's constituents in different columns (or rows).

The MATRIX function in Excel Lab allows you to concatenate arrays intuitively and can be used nested within other Microsoft Excel or Excel Lab functions.

## Syntax

```
output = MATRIX(v1, v2, ...., vN, isRow)
```

{% tabs %}
{% tab title="Input(s)" %}

| Argument         | Description                                                                                                                                                                   |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **v1,v2,...,vN** | Column-vectors, row-vectors, or matrices.                                                                                                                                     |
| **isRow**        | Optional. Logical flag (TRUE or FALSE) to indicated whether you would like to concatenate the input vectors/matrices row-wise. Defaults to false (column-wise concatenation). |
| {% endtab %}     |                                                                                                                                                                               |

{% tab title="Output(s)" %}
Input vectors (or matrices) are concatenated column-wise by default or when isRow is FALSE.

$$
\text{output}=  \begin{bmatrix}v\_1 & v\_2 & \dots & v\_N \end{bmatrix}
$$

When isRow is specified and set to FALSE, the function concatenates the input vectors (matrices) row-wise

$$
\text{output}=  \begin{bmatrix}v\_1 \ v\_2 \ \vdots \ v\_N \end{bmatrix}
$$
{% endtab %}
{% endtabs %}

## Example
