Forum FlexPro – Discuss your topic!

Zugriff auf eine Datenmatrix über die Range Methode

Accueil > Community > Automation and VBA > Zugriff auf eine Datenmatrix über die Range Methode

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #12416
    Norbert RammNorbert Ramm
    Member

    Hallo,
    wie ist es möglich, in eine Kanal der eine Matrixstruktur hat über die Range Anweisung
    einen Abschnitt einer beliebigen Spalte mit
    dem Inhalt eines Arrays zu füllen ?

    Auf einzelne Werte in der Matrix kann wie im
    Beispiel zugegriffen werden.

    Option Explicit
    Public Kanal As DataSet

    Sub Test()
    Dim Wert(3) As Double
    Wert(0) = 11
    Wert(1) = 22
    Wert(2) = 33
    Wert(3) = 44

    If Kanal Is Nothing Then

    Set Kanal = ActiveDatabase.ActiveFolder.Add(“Matrix”, fpObjectTypeDataSet, fpNameClashHandlingOverwrite)
    Kanal.DataStructure = fpDataStructureDataMatrix
    Kanal.DataType(fpDataComponentX) = fpDataTypeFloat32
    Kanal.DataType(fpDataComponentY) = fpDataTypeFloat32
    Kanal.DataType(fpDataComponentAll) = fpDataTypeFloat32
    Kanal.NumberOfColumns = 4
    Kanal.NumberOfRows = 9
    Kanal.FillColumns “(NumberOfValues(i), FloatingPoint32 0, FloatingPoint32 0)”, fpDataComponentAll
    Kanal.Update

    End If

    Kanal.Value(fpDataComponentY, 1, 4) = 40 ‘ i.O.

    Kanal.Range(fpDataComponentY, 1, 1, 1, 4) = Wert ‘ Fehler, Objekt unterstützt Methode nicht

    End Sub

    Hat jemand eine Idee was ich hier falsch mache ?

    #8097
    Norbert RammNorbert Ramm
    Member

    Hallo,
    wie ist es möglich, in eine Kanal der eine Matrixstruktur hat über die Range Anweisung
    einen Abschnitt einer beliebigen Spalte mit
    dem Inhalt eines Arrays zu füllen ?

    Auf einzelne Werte in der Matrix kann wie im
    Beispiel zugegriffen werden.

    Option Explicit
    Public Kanal As DataSet

    Sub Test()
    Dim Wert(3) As Double
    Wert(0) = 11
    Wert(1) = 22
    Wert(2) = 33
    Wert(3) = 44

    If Kanal Is Nothing Then

    Set Kanal = ActiveDatabase.ActiveFolder.Add(“Matrix”, fpObjectTypeDataSet, fpNameClashHandlingOverwrite)
    Kanal.DataStructure = fpDataStructureDataMatrix
    Kanal.DataType(fpDataComponentX) = fpDataTypeFloat32
    Kanal.DataType(fpDataComponentY) = fpDataTypeFloat32
    Kanal.DataType(fpDataComponentAll) = fpDataTypeFloat32
    Kanal.NumberOfColumns = 4
    Kanal.NumberOfRows = 9
    Kanal.FillColumns “(NumberOfValues(i), FloatingPoint32 0, FloatingPoint32 0)”, fpDataComponentAll
    Kanal.Update

    End If

    Kanal.Value(fpDataComponentY, 1, 4) = 40 ‘ i.O.

    Kanal.Range(fpDataComponentY, 1, 1, 1, 4) = Wert ‘ Fehler, Objekt unterstützt Methode nicht

    End Sub

    Hat jemand eine Idee was ich hier falsch mache ?

    #8682
    Bernhard KantzBernhard Kantz
    Participant

    Your example only works if you want to fill a data series. Create a two-dimensional array to fill a data matrix.
    Example:

    
    Dim oValue(0, 3) As Single
    oValue(0, 0) = 11
    oValue(0, 1) = 22
    oValue(0, 2) = 33
    oValue(0, 3) = 44
    
    ...
            
    oDataset.Range(fpDataComponentY, 1, 1, 1, 4).Value = oValue
    

    support@weisang.com

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.