<FINDLOC Example Program>
Program findloc_example Real :: a(2,3) Logical :: m(2,3) a = Reshape( [ 2.,3.,5.,-1.,4.,3. ], [ 2,3 ]) m = Reshape( [ .True.,.True.,.True.,.True.,.False.,.False. ], [ 2,3 ]) Print *, Findloc(a,3.0) Print *, Findloc(a,3.0,Back=.True.) Print *, Findloc(a,3.0,Back=.True.,Mask=m) Print *, Findloc(a,3.0,Dim=1) Print *, Findloc(a,3.0,Dim=2) End
■ Execution Results
2 1 2 3 2 1 2 0 2 0 1