title: cumsum of values for same timeunit
body: <p>i have the following vectors:</p>
  
  <pre><code>A=[1 0 1 0 0 1 0 1 0 0];
  B=[1 2 3 4 5 6 7 8 9 10];
  </code></pre>
  
  <p>in this case A represents a time vector, where the 1s signal the beginning of one time unit.
  now i want to add up all the values in B which correspond to a time unit with the same length of 3 steps.
  So in this example this would mean the 3rd, 4th and 5th value and the 8th, 9th and 10th value of B should be summed cause these are in a time unit of length 3.</p>
  
  <pre><code>B_result=[12 27];
  </code></pre>
  
  <p>i know cumsum() is the command for this but i dont know how to say that only these specific values depending on the time indices of A should be summed.</p>
  
  <p>can you help me?</p>
  
  <p>thanks alot</p>