Topic
Zugriff auf eine Datenmatrix über die Range Methode
Home page › Community › Automation and VBA › Access to a data matrix via the range method
- This topic has 2 replies and 2 voices and was last updated 18 years, 8 months ago ago by Norbert Ramm.
-
AuthorPosts
-
27.10.2006 at 20:46 #34953Norbert RammParticipant
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 DataSetSub Test()
Dim Wert(3) As Double
Wert(0) = 11
Wert(1) = 22
Wert(2) = 33
Wert(3) = 44If 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.UpdateEnd 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 ?
27.10.2006 at 20:46 #34955Norbert RammParticipantHallo,
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 DataSetSub Test()
Dim Wert(3) As Double
Wert(0) = 11
Wert(1) = 22
Wert(2) = 33
Wert(3) = 44If 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.UpdateEnd 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 ?
27.10.2006 at 21:26 #34954Bernhard KantzParticipantYour 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] -
AuthorPosts
- You must be logged in to reply to this topic.