title: Matlab: How to find indices of a specific value in vector
body: <p>How can I find the indices of a specific value in a vector? For example in the following vector:</p>
  
  <pre><code>B = [2 3 4 5 2 7 9 2]
  </code></pre>
  
  <p>I need the index of all occurrences of 2, which is: <code>[1 5 8]</code></p>