MATLAB BUILDER EX 1 Betriebsanweisung Seite 161

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 182
  • Inhaltsverzeichnis
  • FEHLERBEHEBUNG
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 160
Utility Library Classes
D-17
Example. The following Visual Basic code illustrates use of the Initialize
method to dimension struct arrays.
Sub foo ()
Dim x As MWStruct
Dim y As MWStruct
On Error Goto Handle_Error
'Create 1X1 struct arrays with no fields for x, and y
Set x = new MWStruct
Set y = new MWStruct
'Initialize x to be 2X2 with fields "red", "green", and "blue"
Call x.Initialize(Array(2,2), Array("red", "green", "blue"))
'Initialize y to be 1X5 with fields "name" and "age"
Call y.Initialize(5, Array("name", "age"))
'Re-dimension x to be 3X3 with the same field names
Call x.Initialize(Array(3,3))
'Add a new field to y
Call y.Initialize(, Array("name", "age", "salary"))
Exit Sub
Handle_Error:
MsgBox(Err.Description)
End Sub
Property Item([i0], [i1], , [i31]) As MWField
The Item property is the default property of the MWStruct class. This property
is used to set/get the value of a field at a particular index in the structure array.
Seitenansicht 160
1 2 ... 156 157 158 159 160 161 162 163 164 165 166 ... 181 182

Kommentare zu diesen Handbüchern

Keine Kommentare