title: How to use KNN in Matlab
body: <p>I need to use KNN in matlab to find the closest data in training data from <strong><code>A</code></strong>.</p>
  
  <p>I have data in .mat that has this kind of information (training data):</p>
  
  <pre><code>train_data =   1 232 34 21 0.542 
  
                 2 32 333 542 0.32
  </code></pre>
  
  <p>and so on.</p>
  
  <p>Then i have a second information that I will gather through the application but I will only get</p>
  
  <pre><code>A = 2 343 543 43 0.23
  </code></pre>
  
  <p>So now my question is do i only need to do is something like <a href="http://www.mathworks.com/help/toolbox/stats/classificationknnclass.html" rel="nofollow noreferrer">this</a>, and can i use something like <a href="https://stackoverflow.com/questions/10855461/knn-algo-in-matlab">this</a>? </p>
  
  <p>Does KNN need to learn something or do you only need to load test data and some present data (like <strong><code>A</code></strong>) and go through some formula or preload in another function that learns it then through a second function to give you the result.</p>
  
  <p>Best regards.</p>