Next: Range Subscripts, Previous: Coordinate Subscripts, Up: Subscripts [Contents][Index]
Reference to one or more particular elements of an array by index
entails appending the single index (or single array of indices) of the
desired element(s) to the array, between parentheses. The elements of a
multi-dimensional array are stored with higher dimensions changing
slower than lower dimensions. For example, the elements of a
3-by-2-element array u
are stored in the order u(0,0)
,
u(1,0)
, u(2,0)
, u(0,1)
, u(1,1)
,
u(2,1)
, and the fourth element can be referred to both as
u(0,1)
and as u(3)
. The notation u([2,3,5])
extracts the 3rd, 4th, and 5th elements of array u
(because the
first element has index 0).
Index subscripts can also be applied to file arrays (File Arrays) and to strings (Strings).