Reading File knowing certain variables

Especially ssuming x and y are increasing monotonically and the requested value is close to a
table value the MINLOC call is much more robust. Using the M_io procedure the entire
program sans the sample output would then be

program main
use M_io,  only : read_table
implicit none
real,allocatable :: array(:,:), xp, yp
integer :: i,j, ierr
   xp=0.40
   yp=30.0
   call read_table('inputfile',array,ierr)
   associate (x=>array(1,2:),y=>array(2:,1),z=>array(2:,2:) )
      j=minloc(abs(x(:)-xp),dim=1) 
      i=minloc(abs(y(:)-yp),dim=1)
      write(*,*)z(i,j)
   end associate
end program main

That is so much nicer I should probably change the first example of read_table.