title: f90 read .txt file return NaN
body: <p>I am trying to read a .txt file with multiple arrays with a fortran program.</p>
  
  <p>It looks like the program is finding the file but it only returns NaN value...</p>
  
  <pre><code> !
  INTEGER                              :: T, RH, i, j, ierror
  !
  REAL, DIMENSION(3,3)                 :: AFILE
  !
  LOGICAL                              :: dir_e
  
  inquire(file='PSR_FAB.txt', exist=dir_e)
  
  if ( dir_e ) then
   print*, "dir exists!"
  else
   print*, 'nope'
  end if
  
  OPEN (UNIT = 1234 , FILE = 'PSR_FAB.txt', STATUS = 'OLD', ACTION = 'READ')
  
     DO i=1,3
        READ(1234,*, IOSTAT=ierror) (AFILE(i,j),j=1,3)
         print*, (AFILE(i,j),j=1,3)
  !      if (ierror&gt;0) then
  !        stop 'Error while reading from file. '
  !      elseif (ierror&lt;0) then
  !        print* ,PSR_FILE
  !        stop 'Reached end of file. '
  !      endif
     ENDDO
    CLOSE(UNIT=1234)
  !
  T=2
  RH=3
  print*,AFILE(T,RH)
  !    
  </code></pre>
  
  <p>In order to test the program, I'm using the following .txt file:</p>
  
  <pre><code>1 2 3
  4 5 6
  7 8 9
  </code></pre>
  
  <p>Also, when I am using the "ierror if test", the "Reaching end of file" pops out, which mean ierror&lt;0, which mean the end of file is reach.</p>
  
  <p>At first I thought it was because it could not find the file, but when I inquire it, it has no problem finding it...</p>
  
  <p>And as I said earlier, the AFILE contains only NaN value after the file has been read.</p>
  
  <p>I am wondering if the problem lies in the .txt file or in the code. Maybe it is the READ statement, but the code seems ok to me.</p>
  
  <p>I am kind of stuck at the moment and out of ideas... Any thoughts?</p>
  
  <p>Thank you</p>