Next: RESHAPE intrinsic function
Up: Arrays
Previous: Array Expressions
  Contents
We can select sections of an array using the following
subscript-triplet
The subscripts of the array section start at
,
are incremented by
and stop at or before
. The selected subscript values are
similar to the values of the DO-loop variable generated
by the statement
The bounds and the stride must be integer-valued expessions;
if missing, they are assumed to take implicit values as follows:
- missing
: = subscript's
lower bound, as declared.
- missing
: = subscript's
upper bound, as declared.
- missing
: .
For example, let
be the array
.
Note that the subscript's lower bound is , and upper bound is .
Then the following sections can be selected
A(1:3) |
|
A(1:3:2) |
|
A(1:4:2) |
|
A(3:1) |
zero sized section |
A(3:1:-1) |
|
A(:) |
whole array |
A(4:) |
|
A(:2) |
|
A(::4) |
|
A(2:2) |
|
A(2) |
scalar element |
Note that a section of the array is an array itself.
As a second example, consider
REAL, DIMENSION(4,4) :: B
25<25
SetFigFontpt@pt
xxxxxxsplain
Next: RESHAPE intrinsic function
Up: Arrays
Previous: Array Expressions
  Contents
Adrian Sandu
2001-08-26