- 积分
- 60
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-5-18
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
大家好,我在写一个程序的过程中,涉及到读入数据文件及吧结果数据读出,下面是我程序中有关数据读入读出的代码:
module mod_para
implicit none
integer(4)::mx,my,x00,y00
real(8):: h
end module mod_para
!=====================================================================
! MAIN PROGRAM
!=====================================================================
program prog_hasm
use mod_para
implicit none
integer(4):: ierr,novalue,iopt,i,j,nrow,ncol,m=622
character*5 x,y,z,mxs,mys,x0s*10,y0s*10,hs*10,nodata*12
real(8),allocatable:: caiyang(:,:),chazhi(:,:),cx(:),cy(:),cz(:),jieguo(:,:)
allocate(caiyang(m,3),chazhi(mx,my),cx(m),cy(m),cz(m))
!=======================================================================================
OPEN(10,FILE='cy.txt',action='read')
read(10,*) x,y,z
!!!!!分配
iopt = 0
200 iopt = iopt + 1
read(10,300,END=500) caiyang(iopt,1), caiyang(iopt,2), caiyang(iopt,3)
300 format(F20.11,1X,F20.11,1X,F13.11)
go to 200
close(10)
!读入采样文件结束
500 OPEN(10,FILE='cz.txt',action='read')
read(10,*)mys,my !改成*就好了
read(10,*)mxs,mx
read(10,*)x0s,x00
read(10,*)y0s,y00
read(10,*)hs,h
read(10,*)nodata,novalue
do i=1,mx
read(10,100,END=600) (chazhi(i,j),j=1,my)
enddo
close(10)
100 format(I5,<mx> (F9.4,2X))
!读入初值文件
! 500 OPEN(UNIT=20,FILE='rastert_kriging1.txt',FORM='FORMATTED',status='old',access='sequential')
600 cx=caiyang(:,1)
cy=caiyang(:,2)
cz=caiyang(:,3)
allocate(jieguo(mx,my))
OPEN(30,FILE='jieguo.txt',action='write')
write(30,"(A5,I5)")mys,my
write(30,"(A5,I5)")mxs,mx
write(30,"(A10,f13.3)")x0s,x00
write(30,"(A10,f13.3)")y0s,y00
write(30,"(A10,I7)")hs,h
write(30,"(A12,I7)")nodata,novalue
do i=mx,1,-1
write(30,100)(chazhi(i,j),j=1,my)
end do
close(30)
end program prog_hasm
我是个fortran初学者,代码可能写的很差,cy.txt文件是带有一行表头x, y,z的三列数据。cz.txt文件是带有五行表头的矩阵数组文件,大小为mx*my。
当我运行时出现如下错误:
forrt1:sever(64): input conversion error, unit 10, file G:\cy.txt
image pc routine line source
prog_hasm.exe 0040c7d9 unknown unknown unknown
.......
incrementally linked image--pc correlation disabled.
请问这是什么原因啊?有哪里出错了吗?
多谢各位指点。
谢谢
|
|