Language Reference


COLVEC Function

COLVEC (matrix );

The COLVEC function is part of the IMLMLIB library . 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.74: A Column Vector

y
1
2
3
4
5
6



See the ROWVEC function for converting a matrix into a row vector.