title: Reading a matrix in Fortran
body: <p>I try to read and re-write a matrix that has only a particular series of columns. For instance I have an <code>11 x n</code> matrix and I want to rewrite it in a <code>2 x n</code> matrix with only columns 2 and 3. </p>
  
  <pre><code>program fluxXYlambda
  implicit none
  
  INTEGER*8::n,i
  REAL*8,ALLOCATABLE::dati(:,:)
  
  open(10,file='test.txt')
  n=0
  
  do
      read(10,*,end=100)
      n=n+1
  end do
  100 continue
  rewind(10)
  
  allocate(dati(11,n))
  
  open(12,file='coordXY.txt')
  
  do i=1,n
      read(10,*) dati(4,i),dati(5,i)
      write(12,*) dati(4,i),dati(5,i)
  end do
  
  end program flussiXYlambda
  </code></pre>
  
  <p>The file <code>coordXY.txt</code> is created but is empty.</p>