# matrixFromColumns() Function & Examples

Use the matrixFromColumns() matrix function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## matrixFromColumns

#### matrixFromColumns(...arr)

#### matrixFromColumns(row1, row2)

#### matrixFromColumns(row1, row2, row3)

Try it yourself:

```calculio
matrixFromColumns([1, 2, 3], [[4],[5],[6]])
```

[zeros](https://calcul.io/function/zeros/index.md)

---

## Build a matrix from columns

**matrixFromColumns** constructs a matrix by placing supplied vectors or arrays side by side as columns. It makes the orientation explicit when each input represents one variable, feature, or coordinate component.

## Example

Combining `[1,2]` and `[3,4]` produces rows `[1,3]` and `[2,4]`. Use [matrixFromRows](https://calcul.io/function/matrixFromRows/index.md) when inputs are rows instead, and [ctranspose](https://calcul.io/function/ctranspose/index.md) or [transpose](https://calcul.io/function/transpose/index.md) to switch orientation afterwards.

## Shape caveat

Every input column needs the same number of entries. Check the result with [size](https://calcul.io/function/size/index.md) before multiplication or decomposition. Use [concat](https://calcul.io/function/concat/index.md) for generic joining rather than relying on it to communicate a column-oriented intent.

[All functions](https://calcul.io/functions/index.md)
