Topic
Zugriff auf eine Datenmatrix über die Range Methode
Page d'accueil ' Communauté ' Automation et VBA ' Accès à une matrice de données via la méthode Range
- Ce sujet contient 2 réponses, 2 participants et a été mis à jour pour la dernière fois par Norbert Ramm, le il y a 18 années et 6 mois.
-
AuteurMessages
-
27.10.2006 à 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 à 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 à 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] -
AuteurMessages
- Vous devez être connecté pour répondre à ce sujet.