title: Compare two vectors in Matlab
body: <p>I think, the question might have already been asked before. But I could not find proper answer in this forum.</p>
  
  <p>Acutally, I have 2 vectors( of unequal length). I need to compare the 2 vectors. I can do it using a for loop. But it is taking a very  long time.</p>
  
  <p>Any obvious method which I may be missising ?</p>
  
  <p>here is a small code snippet:</p>
  
  <pre><code>a=[ 1 2 3 4 5 6 7 8 1 2 3 4];
  b=[ 2 3 4];
  </code></pre>
  
  <p>How can we compare a and b. Basically I need the index in vector a when comparison returns true.</p>
  
  <p>Thanks</p>