title: How do I use the k-nearest neighbor approach to remove NaNs on Matlab?
body: <p>First of all, I would like to point out that I am a beginner in Matlab, so I apologize if my question sounds dumb. </p>
  
  <p>I have a dataset with 1460 rows, and 36 columns. Three of those columns have some missing values, which appear as NaN. I want to use the k-nearest neighbour approach to estimate those NaNs, but after over 9 hours of trying I'm still not even a step closer to getting a result. </p>
  
  <p>The column with most missing values is the first column, so let's assume I want to work on that first. The professor has told me to first identify which of the other columns is correlated to the first column. Secondly, I have to split my dataset to a row vector of NANs only and a matrix of what's left , let's call it matrix A for simplicity. Thirdly, I have to use knnsearch to find the indices from the matrix A and then replace the NaNs of the row vector by those indices.</p>
  
  <p>For some reason I am not able to understand the instructions, and I do not think my task is supposed to be rocket science. Is there any simpler way? I just need to fill those missing values in through KNN.</p>
  
  <p>Feedback would be appreciated.
  Thank you.</p>