COLVEC Function

COLVEC (matrix ) ;

The COLVEC function converts a matrix into a column vector. If matrix is any $n \times m$ matrix, the COLVEC function returns an $nm \times 1$ vector that contains the elements of matrix in row-major order. The first $m$ elements in the vector correspond to the first row of the input matrix, the next $m$ elements correspond to the second row, and so on, as shown in the following example.

x = {1 2 3, 
     4 5 6};
y = colvec(x);
print y;

Figure 24.1: A Column Vector

y
1
2
3
4
5
6