Skip navigation

Account settings

Topic

Zugriff auf eine Datenmatrix über die Range Methode

Home page Community Automation and VBA Access to a data matrix via the range method

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34953
    Norbert Ramm
    Participant

    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 ?

    #34955
    Norbert Ramm
    Participant

    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 ?

    #34954
    Bernhard 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:
    [code]
    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
    [/code]

    support@weisang.com

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