2013-02-05 1 views
0

테이블 (p, 3)에서 포트란 배열 (n, m)을 변환하는 프로그램 작성에 도움을 원했습니다.포트란 프로그램 오류

나는이 프로그램을 시도 :

program Temp 
implicit none 
real,dimension (23250,27)::table 
real::time 
integer::i 
integer::j 
integer::wl 
integer::al 
    i=1,23250 
read(*,*) time(i),wl(i),(table(i,j),j=1,27) 
j=1,27 
alt(j)=j 
write(*,*) time(i),alt(j),table(i,j) 
continue 
continue 

endprogram Temp 

하지만 오류 메시지가 표시됩니다

D:\Travaux de thèse\modeling\essay\essay.f90(9) : Error: Syntax error, found ',' when expecting one of: <END-OF-STATEMENT> ; 
    i=1,23250 
-----^ 
D:\Travaux de thèse\modeling\essay\essay.f90(11) : Error: Syntax error, found ',' when expecting one of: <END-OF-STATEMENT> ; 
j=1,27 
----^ 
D:\Travaux de thèse\modeling\essay\essay.f90(10) : Error: Constants and expressions are invalid in read-only I/O lists. [TIME] 
read(*,*) time(i),wl(i),(table(i,j),j=1,27) 
----------^ 
D:\Travaux de thèse\modeling\essay\essay.f90(10) : Error: Constants and expressions are invalid in read-only I/O lists. [WL] 
read(*,*) time(i),wl(i),(table(i,j),j=1,27) 
------------------^ 
D:\Travaux de thèse\modeling\essay\essay.f90(12) : Error: This name has not been declared as an array. [ALT] 
alt(j)=j 
^ 
Error executing df.exe. 

essay.exe - 5 error(s), 0 warning(s) 

이 사람이 나를 도울 수 수 있습니까? T 미리 양해 해 주셔서 감사합니다.

+0

S'il의 있니 엮, voyez : http://blog.stackoverflow.com/2009/07/non-english-question- policy/ –

+0

Jeju voudrais une kilo de pomme de terre, s'il vous plais. 죄송합니다, 그게 내가 기억하는 전부입니다 :-) – paxdiablo

답변

0

예제 코드만으로는이 코드의 위치를 ​​파악하기가 다소 어렵습니다. 정의 된 질문에서 언급 한 배열 '배열'은 어디에 있습니까? 루프를 반복하려면 'do'문 [1]을 사용해야합니다. 또한 배열의 차원에 프로그래밍 방식으로 액세스하려고하므로 코드를 하드 코딩 할 필요가 없습니다. 다음 코드 스 니펫은 완전하지는 않지만 어쩌면 그렇게 할 수 있습니다.

program Temp 
implicit none 
real,dimension (23250,27)::table 
integer, dimension(2) :: table_shape 
real::time 
integer::i 
integer::j 
integer::wl 
integer::al 

table_shape = shape(table) 
do i=1, table_shape(1) 
    read(*,*) time(i),wl(i),(table(i,j),j=1,27) 
    do j=1, table_shape(2) 
     alt(j)=j 
     write(*,*) time(i),al(j),table(i,j) 
     !continue 
     !continue 
    enddo 
enddo 

endprogram Temp 

베스트, 최대

[1] http://en.wikibooks.org/wiki/Fortran/Fortran_control

+0

도움을 주셔서 감사합니다. – user2041932