MATLAB BUILDER EX 1 Guida Utente Pagina 139

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
Vedere la pagina 138
Utility Library Classes
Field name only This format may be used only in the case of a
1-by-1 structure array and returns the named
field’s value. For example:
x("red") = 0.2
x("green") = 0.4
x("blue") = 0.6
In this example, the name of the Item
property was neglected. This is possible since
the
Item property is the default property
of the
MWStruct class. In this case the t wo
statements are equiv a lent:
x.Item("red") = 0.2
x("red") = 0.2
Single index and field name This format accesses array elements
through a single subscripting notation. A
single numeric index
n followed by the
field name returns the named field on
the
nth array element, navigating the
array linearly in column-major order.
Forexample,considera2-by-2arrayof
structures with fields
"red", "green",and
"blue" stored in a variable x.Thesetwo
statements are equiv a lent:
y = x(2, "red")
y = x(2, 1, "red")
C-19
Vedere la pagina 138
1 2 ... 134 135 136 137 138 139 140 141 142 143 144 ... 163 164

Commenti su questo manuale

Nessun commento