为了对比两个txt,以2013.txt为准,删除2014.txt中和2013.txt不同的地方。
代码:
[Fortran] 纯文本查看 复制代码 program climate
implicit none
!声明变量
real::lon,lon1
real::lat,lat1
real(kind=8)::dataa,dataa1
integer::status1=0
integer::i,j
!读取
OPEN(11,file='2013.txt',status='old')
OPEN(12,file='2014.txt',status='old')
OPEN(13,file='new2014.txt',status='replace')
do j =1,4189,1
READ(11,*,iostat=status1)lon,lat,dataa
if(status1/=0)exit
do i =1,4548,1
READ(12,*,iostat=status1)lon1,lat1,dataa1
if(lat/=lat1.OR.lon/=lon1) cycle
write(*,*)lon1,lat1,dataa1
write(13,*)lon1,lat1,dataa1
if(status1/=0)exit
end do
end do
CLOSE(11)
CLOSE(12)
CLOSE(13)
end program climate
错误信息如图
|