2016-07-13 28 views
0

這裏是我的Fortran代碼的一部分之後編譯給我一個錯誤說「ICOUNT在(1)不是一個變量「ICOUNT」在(1)不是一個變量

在這裏不用我的代碼:

integer*4 iy1 
    integer*2 id1,im1 
    parameter (month=12,maxper=5,specmax=8) 
    real conc(month,8,icount(8,month)) 
    integer smonth(12),icount(8,month) 
    real per(maxper),rper(maxper) 
    data smonth/12,1,2,3,4,5,6,7,8,9,10,11/ 
    data per/0.10,0.25,0.5,0.75,0.90/ 



open(unit=1`,file='data_co.txt',status='old') 
open(unit=2,file='chennai_alldatatop10.txt',status='unknown',iostat=ierr) 
if(ierr.eq.0)close(2,status='delete') 
open(unit=2, file='chennai_alldatatop10.txt',status='unknown') 

    inum=0 
2 read(2,*,end=3)id1,im1,iy1,conc1 
    icount(1,im1)=inum+1 
    conc(im1,1,icount(1,im1))=conc1 
    goto 2 
3 continue 


    end 
+0

我已經很多年沒有寫Fortran語言,但我不是因爲你使用它的任何地方定義的變量'icount'。這可能是問題嗎? –

+0

它已經在頂部的聲明部分定義了 – Nick

回答

0

在你的代碼的頂部變量聲明,您切換順序:

real conc(month,8,icount(8,month)) 
integer smonth(12),icount(8,month) 

您正在使用icount你定義它之前,所以你的代碼應該是這樣的:

integer smonth(12),icount(8,month) 
real conc(month,8,icount(8,month)) 

但實際上,這也沒有任何意義,如果icount(8, month)尚未初始化爲值。所以,你的代碼應該這個樣子:

integer smonth(12), icount(8,month) 
real conc(month, 8, some_scalar_value) 
+1

謝謝你解決了我的問題:)。 – Nick

+3

現在解決它,並使用'隱式無'。 –