title: Extract multiple indices from matrix
body: <p>I want to access multiple indices of a matrix as shown below. So what I want is indices (1,3),(2,6),(3,7) to be set to one. However, as you can see the entire column is set to one. I can see what it is doing but is there a way to do what I want it to (in an elegant way - no loops).</p>
  
  <pre><code>a=zeros(3,10)
  a(1:3,[3 6 7])=1
  
  a =
  
   0     0     1     0     0     1     1     0     0     0
   0     0     1     0     0     1     1     0     0     0
   0     0     1     0     0     1     1     0     0     0
  </code></pre>
  
  <p>I realise that you can do something along the lines of </p>
  
  <pre><code>x_idx=1:3, y_idx=[3 6 7];
  idx=x_idx*size(a,2)+y_idx;
  a(idx)=1;
  </code></pre>
  
  <p>but just wondering if there was a better, or proper way of doing this in Matlab</p>