title: Find the closest value in a matrix matlab
body: <p>How can I find the closest element in a matrix in matlab?</p>
  
  <p>Suppose I have a matrix of the size <code>300x200</code> and I want to find the value and the index of the element in the matrix which is the closest to a element given.</p>
  
  <p>Does anyone know how this can be done in matlab? I know how to do this for a given array but I can not figure out how this is done for a matrix.</p>