\(\text{NumberColumns}\)

You can use the \(\text{NumberColumns}\) function to determine the number of columns in a matrix.

You can use the \ncols backslash command to insert this function.

The following variants of this function are available:

  • \(\text{integer } \text{NumberColumns} \left ( \text{<matrix>} \right )\)

The \(\text{<matrix>}\) value is the matrix to determine the number of columns in. The function returns an integer value indicating the number of columns.

Below is a basic example using the \(NumberColumns\) function.

\[\begin{split}A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}\end{split}\]
\[a = \text{NumberColumns } A \;\;\;\; \text{a = 3}\]