我正在编写一个 Fortran 程序,其中一行是这样写的
open(unit=un1,file=filenm,form='unformatted',buffered='yes',status='replace',buffercount=127)
Run Code Online (Sandbox Code Playgroud)
我已经定义了
character*256 filenm.
un1=11
Run Code Online (Sandbox Code Playgroud)
但我仍然收到错误
"Syntax error at or near =" in that line..
Run Code Online (Sandbox Code Playgroud) 这是我的计划
program matrix
real :: J1(38,38),J2(38,29),J3(29,38),J4(29,29)
real :: J13(38,1),J23(29,1),J33(1,68),Jac(68,68)
!!all matrices contains some values except Jac
Jac=[J1 J2 J13
J3 J4 J23
J33 ]
end program matrix
Run Code Online (Sandbox Code Playgroud)
现在我想将所有这些矩阵放入1矩阵Jac(68,68),以便Jac = [J1 J2 J13 J3 J4 J23 J33]应该是什么样的fortran代码..请帮助我.
我有一个数据文件,其中以这种方式填充数据
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
.
.
.
.
.
91 92 93 94 95 96 97 98 99 100
Run Code Online (Sandbox Code Playgroud)
我想将这些数据存储在(10,10)的矩阵中,这是我的程序
program test
integer j,n,m
character,dimension(10,10) ::text
character*50 line
open(unit=3,file="tmp.txt",status='old')
n=1
read(3,"(a50)"),line
read(line,*,end=1),(text(1,i),i=1,10)
1 read(3,"(a50)",end=3),line
n=n+1
read(line,*,end=1)(text(n,i),i=i,10)
3 close(3)
end program test
Run Code Online (Sandbox Code Playgroud)
但我没有得到正确的价值观.