为什么write设定输出格式之后写的矩阵内容就变成一列了?
请教一下各位大佬:我把write的输出格式从任意的*换成''(F7,2)"之后,一个输出的文件的401x401数据直接就变成了一列,想请教一下怎么回事?原代码:
real BuildM(401,401)
write(*,*)'START INPUT BUILDING MATRIX'
open(9999,file='SimpleBuilding_v1.txt')
DO J=1,401,1
READ(9999,*) (BuildM(I,J),I=1,401)
end DO
CLOSE(9999)
open(9991,file='BuildMoutput.txt')
DO J=1,401,1
write(9991,*) (BuildM(I,J),I=1,401)
end DO
CLOSE(9991)
write(*,*)'END INPUT BUILDING MATRIX'
end
我把write改成write(9991,''(F7,2)") (BuildM(I,J),I=1,401),输出的BuildMoutput.txt文件的数据由401x401直接变成一列了,搞不明白怎么回事,请教一下
因为write(9991,"(F7.2)")指定每一行只写一个数。可改成write(9991,"(401F7.2)"). 风平老涡 发表于 2021-10-9 20:15
因为write(9991,"(F7.2)")指定每一行只写一个数。可改成write(9991,"(401F7.2)").
谢谢大佬,我发的两个问题都是您回答的,非常感谢您!
页:
[1]