title: Incrementing one value of a MATLAB array multiple times in one line
body: <p>This is a question about incrementing one value of a MATLAB array multiple times in the same statement, without having to use a for loop.</p>
  
  <p>I set my array as:</p>
  
  <pre><code>&gt;&gt; A = [10 20 30];
  </code></pre>
  
  <p>And then run:</p>
  
  <pre><code>&gt;&gt; A([1, 1]) = A([1, 1]) + [20 3]
  
  A =
  
      13    20    30
  </code></pre>
  
  <p>Clearly the 20 is ignored. However, i would like it to be included, so that:</p>
  
  <pre><code>&gt;&gt; A = [10 20 30];
  &gt;&gt; A([1, 1]) = A([1, 1]) + [20, 3]
  </code></pre>
  
  <p>would give:</p>
  
  <pre><code>A =
  
      33    20    30
  </code></pre>
  
  <p>Is there a function to allow this to be done in a nice, vectorised fashion? </p>
  
  <p>(In reality, the indexing to the array would include multiple indexes, so it could be <code>[1 1 2 2 1 1 1 1 3 3 3]</code> etc., with an array of numbers to increment by (the <code>[20, 3]</code> above) of the same length.)</p>