mikibelavista
Technical User
- Jan 18, 2012
- 32
I have array and I want to compare elements,how many 100.3 10.0 pairs do I have
100.3 10.0
110.0 10.0
100.3 10.0
I have tried this:
program pck
implicit none
real,dimension(10,2) :: a
integer,dimension(10) :: b
integer :: i,check
open(10,file='pic.txt')
do i=1,10
read(10,*)a(i,
end do
forall (i=1:10)
where (a(i, == a(i,)
check=check+1
check=b(i)
end where
end forall
end program
But:
pck.f90:16.1:
check=check+1
1
Warning: The FORALL with index 'i' is not used on the left side of the assignment at (1) and so might cause multiple assignment to this object
pck.f90:17.1:
check=b(i)
1
Warning: The FORALL with index 'i' is not used on the left side of the assignment at (1) and so might cause multiple assignment to this object
pck.f90:16.1:
check=check+1
1
Error: WHERE assignment target at (1) has inconsistent shape
pck.f90:17.1:
check=b(i)
1
Error: WHERE assignment target at (1) has inconsistent shape
100.3 10.0
110.0 10.0
100.3 10.0
I have tried this:
program pck
implicit none
real,dimension(10,2) :: a
integer,dimension(10) :: b
integer :: i,check
open(10,file='pic.txt')
do i=1,10
read(10,*)a(i,
end do
forall (i=1:10)
where (a(i, == a(i,)
check=check+1
check=b(i)
end where
end forall
end program
But:
pck.f90:16.1:
check=check+1
1
Warning: The FORALL with index 'i' is not used on the left side of the assignment at (1) and so might cause multiple assignment to this object
pck.f90:17.1:
check=b(i)
1
Warning: The FORALL with index 'i' is not used on the left side of the assignment at (1) and so might cause multiple assignment to this object
pck.f90:16.1:
check=check+1
1
Error: WHERE assignment target at (1) has inconsistent shape
pck.f90:17.1:
check=b(i)
1
Error: WHERE assignment target at (1) has inconsistent shape