[問題] 請問要怎麼寫才對...
我的程式碼如下:
open(1,file='10-0123-20L.S200510')
open(2,file='list')
do while (.true.)
read(1,'(1x,i4,1x,i2,i2,1x,i2,i2,1x,i2.2,f2.1,4x,f6.3,1x,f7.3,
& i3.3,f2.1,t80,a1)',end=99)
& year,mon,day,hour,min,se1,se2,lat,lon,d1,d2,typ
end do
do while (.true.)
read(1,'(1x,a4,4x,a2,7x,i2.2,i2.2,1x,i2.2,f3.2)',end=999)
& sta,phas,hh,mm,s1,s2
if((typ=='1').and.(phas=='IP'))then
parr=((hour*60+min)*60+(se1+se2))-((hh*60+mm)*60+(s1+s2))
write(2,'(f6.3,1x,f7.3,1x,i3.3,f2.1,1x,i4,1x,i2.2,1x,i2.2,1x
& ,i2.2,1x,i2.2,1x,i2.2,f2.1)')
& lat,lon,d1,d2,year,mon,day,hour,min,se1,se2,sta,phsa,parr
end if
end do
99 continue
999 continue
close(1)
close(2)
END
這是想要用來讀一個檔案裡面的資訊,再做輸出.
但是只有第一段do while讀得出來,為什麼第二段do while讀不出來?
檔案內容大致如下:
2005 1010 0123 20.1fL 21.310 120.068 7.0 TW6 3 0.0 1
GAP=154 0.32 1.0 0.9 2.0 -0.2403E+00 0.4331E+00 0.2387E+00E
2005-10-10-0123-16.obs01_001 6
ACTION:UP 14-02-11 14:29 OP:debb STATUS: ID:20051010012320 L I
OBS6 SZ IP 123 25.94 44 -0.0610 19.0 87
照這檔案來看,我只想要第一列和第四列.
先謝謝大家了!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.69.195
→
03/19 21:23, , 1F
03/19 21:23, 1F
→
03/19 21:24, , 2F
03/19 21:24, 2F
→
03/19 21:25, , 3F
03/19 21:25, 3F
Fortran 近期熱門文章
PTT數位生活區 即時熱門文章