<MAXLOC Example Program>
Program maxloc_example Real :: a(2,3) a = Reshape( (/2.,3.,5.,-1.,4.,-3./), (/2,3/)) Print *, Maxloc(a) Print *, Maxloc(a,Dim=1) Print *, Maxloc(a,Dim=2) Print *, Maxloc(a,Mask=a<5) End
■ Execution Results
1 2 2 1 1 2 1 1 3
Program maxloc_example Real :: a(2,3) a = Reshape( (/2.,3.,5.,-1.,4.,-3./), (/2,3/)) Print *, Maxloc(a) Print *, Maxloc(a,Dim=1) Print *, Maxloc(a,Dim=2) Print *, Maxloc(a,Mask=a<5) End
1 2 2 1 1 2 1 1 3