User`s guide
D Utility Library
D-18
Parameters.
Remarks.
When accessing a named field through this property, you must supply
all dimensions of the requested field as well as the field name. This property
always returns a single field value, and generates a bad index error if you
provide an invalid or incomplete index list. Index arguments have four basic
formats:
• 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 two statements are equivalent:
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.
For example, consider a 2-by-2 array of structures with fields
"red", "green",
and "blue" stored in a variable x. These two statements are equivalent:
y = x(2, "red")
y = x(2, 1, "red")
Argument Type Description
i0
,i1, …, i31
Variant
Optional index arguments. Between 0
and 32 index arguments can be entered.
To reference an element of the array,
specify all indexes as well as the field
name.