ProductName  

Returns a one-column matrix (vertical vector) using one column of the current matrix object.

Syntax

MatrixObject.ColVector(ColIndex)

Return Value

A reference to the one-column matrix.

Parameters

ColIndex
Optional. Long integer specifying the column you want to return as a vector. The default value is 0 (the first column).

Error Codes

Error 1320 will be returned, if ColIndex exceeds matrix size.

Example

This example demonstrates the use of the ColVector and RowVector methods.

Private Sub MatrixToVector()

Dim A As New Matrix
Dim CV As Matrix, RV As Matrix

    A.Size 5, 3
    A.FillRandom
    Debug.Print "A="
    Debug.Print A.GetString

    Set RV = A.RowVector(3)
    Debug.Print "Row Vector using row# 3"
    Debug.Print "RV="
    Debug.Print RV.GetString

    Set CV = A.ColVector(2)
    Debug.Print "Column Vector using column# 2"
    Debug.Print "CV="
    Debug.Print CV.GetString

End Sub

Output

A=
| 7,000 5,000 6,000 |
| 3,000 3,000 8,000 |
| 0,000 8,000 8,000 |
| 7,000 0,000 4,000 |
| 9,000 8,000 4,000 |

Row Vector using row# 3
RV=
| 7,000 0,000 4,000 |

Column Vector using column# 2
CV=
| 6,000 |
| 8,000 |
| 8,000 |
| 4,000 |
| 4,000 |

See Also

RowVector Method

Applies To: Matrix | CMatrix