我有一个Fortran 77的这样的代码,或多或少:更新矩阵到一个文本文件,而无需将结果追加
nMaxRow=100
nMaxStep=100
! initialization of the matrix if Step=1
do step=1,nMaxStep
if (step.eq.1) then
do ii=1,nMaxRow
do jj=1,nMaxStep
A(ii,jj)=0
end do
end do
end if
!now for each step and for each row update the cell of the matrix
do ii=1,nMaxRow
A(ii,step)=X(ii) !X(ii) is a number associated with the specific ow at that specific step
end do
!Now I want to write the updated matrix at this step into a text file,
!How can I do that????
end do !close the do step...
是否有可能更新矩阵的值,并在写更新的矩阵该文本文件的具体步骤?我的意思是,不附加结果的每一步......
我发现对于Fortran 90的的“替换”命令存在......但我无法找到任何类似的Fortran 77中
一个简单想法会在写一个新文件之前删除文件...但我不喜欢它,我不知道怎么做。
你使用的编译器不支持'STATUS ='REPLACE''?在任何情况下,如果你打开'STATUS ='UNKNOWN'' – agentp
@agentp,大多数编译器返回到f77都会替换。我没有在我的Fortran 77中找到状态REPLACE,因此我认为它确实是F90。我默默地认为编译器会在我的答案中重新打开替换。 –
REPLACE是f90,我的观点是他很可能没有真正的f77编译器。 – agentp