I have recently learned how to work with basic files in Fortran and I assumed it was as simple as:
open(unit=10,file=\"data.dat\")
read(10,*) some_variable,
Then your problem was that your file was a row vector, and it was likely giving you this error immediately after reading the first element, as @M.S.B. was suggesting.
If you have a file with a NxM matrix and you read it in this way (F77):
DO i=1,N
DO j=1,M
READ(UNIT,*) Matrix(i,j)
ENDDO
ENDDO
it will load the first column of your file in the first row of your matrix and will give you an error as soon as it reaches the end of the file's first column, because the loop enforces it to read further lines and there are no more lines (if N
j=N+1
for example). To read the different columns you should use an implicit loop, which is why your solution worked:
DO i=1,N
READ(UNIT,*) (Matrix(i,j), j=1,M)
ENDDO