Fortran Coder

我一早上就光debug这个了,真心不知道错在哪!

查看数: 7718 | 评论数: 2 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2014-10-24 10:11

正文摘要:

代码如下: [Fortran] 纯文本查看 复制代码program getdata       implicit none       integer::I,J,K,N,M       character(len=20)::fname   & ...

回复

楚香饭 发表于 2014-10-24 22:32:41
这个错误我无法重现,可能是日文系统的问题,我也无法解释。
Villain 发表于 2014-10-24 10:47:13
自己试了一下,把open(12,file=trim(fname),status='old') 中的12换成22 成功运行。这是为什么??
我已经用一下代码试过:
[Fortran] 纯文本查看 复制代码
program getdata
      implicit none
      integer::I,J,K,N,M
      character(len=20)::fname
      character(len=100)::path
      real::hmax
      real,dimension(30)::hh
      real,dimension(30,730)::h,tub,tt
      real,dimension(30)::ht,tubt,ttt
      open(11,file="name.txt",status="old")
      open(13,file="WT.csv")
      open(14,file="TURB.csv")

      hmax=0.0
      do I=0,28
        hh(I+1)=120.0+i*0.5
      enddo
      write(13,*)"天数","時間"
      write(13,"(I5,',',I5,',',29(f5.1,','))")1,9,(hh(I),I=1,29)
      write(14,*)"天数","時間"
      write(14,"(I5,',',I5,',',29(f5.1,','))")2,9,(hh(I),I=1,29)
      I=0
      h=-999.0
      tub=-999.0
      tt=-999.0
      ht=-999.0
      tubt=-999.0
      ttt=-999.0
      do
        read(11,*,end=30)fname
        write(*,*)fname
       path='mkinput\'//trim(fname)
      write(*,*)trim(path)
!        open(99,file=trim(fname) )
        pause
        open(12,file=trim(fname),status='old')
        read(12,*)
        I=I+1
        J=0
        do
          J=J+1
          read(12,*,end=20)ht(J),tubt(J),ttt(J)
          if (hmax<ht(J)) hmax=ht(J)
          if(J==1) then
            if(ht(J)-float(floor(ht(J)))>0.25 .and.ht(J)-float(floor(ht(J)))<0.75) then
              ht(J)=float(floor(ht(J)))+0.5
            elseif(ht(J)-float(floor(ht(J)))>=0.75) then
              ht(J)=float(floor(ht(J)))+1.0
            else
              ht(J)=-999.0
              tubt(J)=-999.0
              ttt(J)=-999.0
            endif
          endif
20        close(12)
        enddo
lp1:    do K=1,29
          do N=1,29
            if((hh(K)-ht(N))<0.001) then
              h(K,I)=ht(N)
              tub(K,I)=tubt(N)
              tt(K,I)=ttt(N)
              cycle lp1
            endif
          enddo
        enddo lp1
        write(13,*)fname(1:4),fname(5:6),fname(7:8),fname(9:10),(tt(N,I),N=1,29)
        write(14,*)fname(1:4),fname(5:6),fname(7:8),fname(9:10),(tub(N,I),N=1,29)
      enddo
30    write(*,*)"normal end"     
end

可以操作。
疯了

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2025-4-20 20:08

Powered by Tencent X3.4

© 2013-2025 Tencent

快速回复 返回顶部 返回列表