title: nearest element MATLAB
body: <p>I want to find the index of the nearest element in <code>x=0:0.1:pi/2</code> to a given number <code>z=0.65</code>.
  I did already this, but I want something better:
  <code>[C,I]=min(abs(x-z))</code>.
  <code>I</code> is the index of the nearest element.</p>