title: Finding the neighbourhood of certain pixels
body: <p>I have an image which matrix has some pixels with value <code>NaN</code>. For such certain pixel, I want to compare its <code>8-neighbourhood</code>, and assign it a value based on that neighborhood.</p>
  
  <p>I think for the neighbourhood we use <code>nlfilter</code>? </p>
  
  <p>How can I do that in <code>matlab</code>?</p>
  
  <p>Thanks.</p>