<-- Previous || Up || Next -->

Variant Matrix Column To Vector Function
Array Conversions Class

Public Function VariantMatrixColumnToVector( _
      ByRef rTo() As Variant _
    , ByRef vFm() As Variant _
    , ByVal vColumnNumber As Variant _
    ) As Boolean

Copies a Column from a two-dimensionsional Variant array into a one-dimensional array.

Example:
    Assuming
       Static avarTable(0 To 2, 0 To 2) As Variant
       ' Column--v  v--Row
       avarTable(1, 1) "James"
       avarTable(2, 1) "Johnson"
       avarTable(1, 2) "Sam"
       avarTable(2, 2) "Smith"
       Dim avarFirst() As Variant
    for example
       VariantMatrixColumnToVector(avarFirst(), avarTable(), 1) = True
    leaves
       LBound(avarFirst) = 0
       UBound(avarFirst) = 2
       IsEmpty(avarFirst(0)) = True
       avarFirst(1) = "James"
       avarFirst(2) = "Sam"
See also:
    VariantMatrixRowToVector Function
    VariantVectorToMatrixColumn Function
rTo: Dynamic, one-dimensional Variant array that will receive the values. rTo must be dynamic so that this function can re-dimension it appropriately. rTo need not be initialized (with ReDim) before being passed to this function. rTo will be re-dimensioned from LBound(vFm, 2) to UBound(vFm, 2).
vFm: Two-dimensional array of Variants from which one of the columns will be copied. Within this array, dimension #1 represents the Column and dimension #2 represents the Row. This is because the number of rows changes most frequently and the upper bound of the last dimension (representing the row) can be re-dimensioned directly by Visual Basic.
vColumnNumber: Number of the Column whose values will be copied.
Return value: Function does nothing and returns False if vColumnNumber is Null or cannot be fixed-up to a number. Function currently returns True in all other cases.

 

Return to ENTISOFT Home Page

Copyright © 1999-2005 Entisoft