|
Program Www_fcode_cn
Implicit None
Character *5 Filename
Character *4 Filename1
Integer :: I, J
Integer :: A(6)
Open (10, File='D:\a\year.txt')
Do J = 1961, 2013
Read (10, *) Filename1
Open (J, File='D:\c\'//Filename1//'.txt') !// 11 改为 j
End Do
Open (12, File='D:\a\tem.txt')
Do I = 1, 525
Read (12, *) Filename
Open (13, File='D:\a\'//Filename//'.txt')
Do J = 1961, 2013
Read (13, *) A(:)
Write (A(5), *) A(:)
End Do
Close (13)
End Do
Close (12)
Do J = 1961, 2013
Close (J)
End Do
Close (10)
End Program Www_fcode_cn
这个是您帮助另一个同学改写的,我拿来参考(我们遇到的问题是几乎一样的,她是提取特定的年份,我是提取特定的坐标作为result文件的名字):
Program main
Implicit None
Character(160) :: Filename
Character(160) :: fn1,fn2,fn3,tmp
Integer :: I, J,num
real :: A(4), B(4), C(4)
integer ios
fn1='c6c8_ID_'
fn2='c6_'
fn3='c8_'
num=160 ! total number of result files
print*, 'Running'
do J = 1, num
write (tmp,*)J
C print*, J
open (j,File="D:\c6c8\"//trim(adjustl(fn1))//trim(adjustl(tmp))//'.dat',status='unknown') ! save result here
write (j,'(3f8.3)') 0.0,0.0,1.0
enddo
open (20, File='IDlist.dat',status='old') ! 里面存放的是10的倍数
do I = 1, 9200
read (20, *,iostat=ios) Filename
if (ios /=0) then
exit
endif
c print*, filename
open (200,File="D:\C6\"//trim(adjustl(fn2)) //trim(adjustl(filename))//'.dat')
open (300,File="D:\C8\"//trim(adjustl(fn3)) //trim(adjustl(filename))//'.dat')
Do J = 1, num
Read (200, *) A(:) ! first row=ID number, then x,y,z
Read (300, *) B(:) ! first row=ID number
C(:)=B(:)-A(:)
c print*, c(:)
Write (c(1), '(3f8.3)') C(2:4) ! first row=ID number
c End Do
Close (300)
Close (200)
enddo
enddo
Close (20)
Do J = 1, num
Close (J)
End Do
End Program
从周五开始我已经连续改了三天,不知道是什么错误。非常想学习如何不使用(if ID=特定数)的判定语句的情况下达成同样result的程序的写法,特别向您请教程序问题的所在!
|
|