MATLAB BUILDER EX 1 Guide de l'utilisateur Page 161

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 182
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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.
Vue de la page 160
1 2 ... 156 157 158 159 160 161 162 163 164 165 166 ... 181 182

Commentaires sur ces manuels

Pas de commentaire