fortran中将数组输出至txt文件的问题
programQFactorcharacter*80fpiwav,fpiwav1,fpiwav2,strintegermaxlenparameter(maxlen=100...
program QFactor
character*80 fpiwav,fpiwav1,fpiwav2,str
integer maxlen
parameter (maxlen=100000)
integer maxfreq
integer mch,nSamp,ntnew
REAL, ALLOCATABLE ::RECD(:,:)
real Tdelay(40)
open(10,file='timedelay.txt')
do i=1,40
read(10,*) Tdelay(i)
enddo
close(10)
fpiwav='shot-blend1.sgd'
open(50,file=fpiwav,access='direct',recl=100,FORM='FORMATTED'
& ,status='old')
read(50,rec=1)mCh,nSamp,dx,dt,ofr,t0 !道数/采样点数/道间距/采样间隔
!偏移距/起跳时间
close(50)
! write(*,*) mch,nSamp,dx,dt,ofr,t0
allocate( Recd(mCh,nSamp)) !12*400 1500
ich=0
nrec=nSamp*4 !四个字节
open(50,file=fpiwav,access='direct',recl=nrec,FORM='FORMATTED'
& ,status='old')
do i=1,mCh
ich =ich+1
read(50,rec=i+1)(Recd(ich,j),j=1,nSamp)
end do
close(50)
deallocate(recd)
end
之前的代码已经读取了Recd这个数组,为5000x2000的数组,请问下我如何将这个数组以5000x2000的格式输出到txt文件中? 展开
character*80 fpiwav,fpiwav1,fpiwav2,str
integer maxlen
parameter (maxlen=100000)
integer maxfreq
integer mch,nSamp,ntnew
REAL, ALLOCATABLE ::RECD(:,:)
real Tdelay(40)
open(10,file='timedelay.txt')
do i=1,40
read(10,*) Tdelay(i)
enddo
close(10)
fpiwav='shot-blend1.sgd'
open(50,file=fpiwav,access='direct',recl=100,FORM='FORMATTED'
& ,status='old')
read(50,rec=1)mCh,nSamp,dx,dt,ofr,t0 !道数/采样点数/道间距/采样间隔
!偏移距/起跳时间
close(50)
! write(*,*) mch,nSamp,dx,dt,ofr,t0
allocate( Recd(mCh,nSamp)) !12*400 1500
ich=0
nrec=nSamp*4 !四个字节
open(50,file=fpiwav,access='direct',recl=nrec,FORM='FORMATTED'
& ,status='old')
do i=1,mCh
ich =ich+1
read(50,rec=i+1)(Recd(ich,j),j=1,nSamp)
end do
close(50)
deallocate(recd)
end
之前的代码已经读取了Recd这个数组,为5000x2000的数组,请问下我如何将这个数组以5000x2000的格式输出到txt文件中? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询