- #1
autobot.d
- 68
- 0
Have data that is coming from Matlab and want to read it into Fortran. Simple example of what I have:
I have tried csv, dat, prn file extensions. If I get rid of one of the loops and just read in a vector than I am fine. As soon as I try read in the whole matrix I get the error:
Fortran runtime error: End of file
Also, this code worked for me before, but that is when Fortran wrote the data file.
Any help is appreciated. Thanks.
Code:
PROGRAM file_read
IMPLICIT NONE
REAL, ALLOCATABLE :: read_matrix(:,:)
INTEGER :: i,j
OPEN(1,FILE = 'data_wanted.prn', ACTION = 'READ', STATUS = 'OLD')
do i = 1,50
do j = 1,25
READ(1,*) read_matrix(i,j)
end do
end do
END PROGRAM file_read
I have tried csv, dat, prn file extensions. If I get rid of one of the loops and just read in a vector than I am fine. As soon as I try read in the whole matrix I get the error:
Fortran runtime error: End of file
Also, this code worked for me before, but that is when Fortran wrote the data file.
Any help is appreciated. Thanks.