| 
 
	积分210贡献 精华在线时间 小时注册时间2013-6-26最后登录1970-1-1 
 | 
 
| 
本帖最后由 寄居蟹 于 2013-9-3 15:24 编辑
x
登录后查看更多精彩内容~您需要 登录 才可以下载或查看,没有帐号?立即注册 
  
 program main
 
 
 PARAMETER (K_MAX=1, NT=37,IN=21,nV=2) !nv means the number of variables
 ! define 2D array:
 real,dimension(in,nt,nv) :: va
 character variable(2)*10
 data variable/'h','t'/
 irec=1
 do m=1,nv
 ! now read data
 open(m,file=''//trim(variable(m))//'_0813.dat',form='binary',&
 recl=nt*in*4)
 read(m,rec=irec)((va(i,j,m),i=1,in),j=1,nt)
 irec=irec+1
 close(m)
 end do
 stop
 end
 出现问题如下:
 我把两个文件分开一起读的时候, program main
 PARAMETER (K_MAX=1, NT=37,IN=21)
 ! define 2D array:
 real,dimension(in,nt) :: t,h
 irec=1
 ! now read data
 open(21,file='T_0813.dat',form='unformatted',&
 recl=nt*in*4)
 read(21,rec=irec)((t(i,j),i=1,in),j=1,nt)
 irec=irec+1
 close(21)
 
 open(20,file='h_0813.dat',form='unformatted',&
 recl=nt*in*4)
 read(20,rec=irec)((h(i,j),i=1,in),j=1,nt)
 irec=irec+1
 close(20)
 stop
 end
 
 也是读第二个文件就出现相同的错误。看到一个文章上说fortran错误代码36是一下解释
 severe (36): Attempt to access non-existent record
 FOR$IOS_ATTACCNON. A direct-access READ or FIND statement
 attempted to access beyond the end of a relative file (or a sequential file
 on disk with fixed-length records) or access a record that was previously
 deleted from a relative file.
 求各位指导下错误原因!谢谢!
 
 
 
 
 | 
 
  |