# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://excelhelp.windhamlabs.com/functions/general/matrix.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
