Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Io FORTRAN中的读取格式_Io_Fortran - Fatal编程技术网

Io FORTRAN中的读取格式

Io FORTRAN中的读取格式,io,fortran,Io,Fortran,我正在尝试从外部文件读取矢量分量: .dat(仅一行,数字之间用逗号分隔): 我不能提供MWE,因为代码很大,但这是其中的一部分: OPEN (91,file= 'imposed.dat',form='formatted',status='old') read(91,*) CU1P(:) write(*,*) 'read once imposed profile...' DO J=2,5 write(*,*) 'printf CU1P(J) ',CU1P(J) END DO 其中CU1P

我正在尝试从外部文件读取矢量分量:

.dat(仅一行,数字之间用逗号分隔):

我不能提供MWE,因为代码很大,但这是其中的一部分:

OPEN (91,file= 'imposed.dat',form='formatted',status='old') 
read(91,*) CU1P(:)
write(*,*) 'read once imposed profile...'
DO J=2,5
  write(*,*) 'printf CU1P(J) ',CU1P(J)
END DO
其中CU1P定义为

  REAL*8 CU1P(0:129)
我得到的错误是

forrtl: severe (24): end-of-file during read, unit 91, file /data/forcing/imposed.dat

我以前读过这样的文件,所以我不知道发生了什么,我错过了什么吗?

你不是想从一个有6个字符的文件中读取130个项目吗?你能详细介绍一下你期望的结果吗?我明白你的意思,但是FORTRAN没有将输入数据分配到第六个组件吗?不管定义变量的大小(我的意思是,它更大)@Andrea,no.Fortran(这是该语言名称的正确拼写)都将尝试从composed.dat读取130个数字。如果您只需要6个数字或只有6个数字,请使用
read(91,*)CU1P(0:5)
好的,谢谢大家!史提夫,考虑写一个正确的答案,所以OP可以接受它。
forrtl: severe (24): end-of-file during read, unit 91, file /data/forcing/imposed.dat