主题:求助,关于if-else-if循环读取文件
以下代码编译通过了,t2mb(k,j)数据正确,t2ma(k,j),t2mc(k,j),t2md(k,j)数据都为零,是什么地方出问题了?
do k=1,8
do j=1,4
open(40+j,file=fname(k,j))
read(40+j,"(a80)")string
read(40+j,*)year,month,day0,time,dtime,a,b,c,d,e,num
do i=1,num
read(40+j,*)line,lon,lat,high,t
if(lon==int(lonxy) .and. lat==int(latxy))then
t2mb(k,j)=t
else if(lon==int(lonxy) .and. lat==int(latxy+1))then
t2ma(k,j)=t
else if(lon==int(lonxy+1) .and. lat==int(latxy))then
t2mc(k,j)=t
else if(lon==int(lonxy+1) .and. lat==int(latxy+1))then
t2md(k,j)=t
end if
end do
end do
end do
do k=1,8
do j=1,4
open(40+j,file=fname(k,j))
read(40+j,"(a80)")string
read(40+j,*)year,month,day0,time,dtime,a,b,c,d,e,num
do i=1,num
read(40+j,*)line,lon,lat,high,t
if(lon==int(lonxy) .and. lat==int(latxy))then
t2mb(k,j)=t
else if(lon==int(lonxy) .and. lat==int(latxy+1))then
t2ma(k,j)=t
else if(lon==int(lonxy+1) .and. lat==int(latxy))then
t2mc(k,j)=t
else if(lon==int(lonxy+1) .and. lat==int(latxy+1))then
t2md(k,j)=t
end if
end do
end do
end do