title: repeat values in a row 'N' number of times and then increment the values - Matlab (varying N)
body: <p>I have a matrix:</p>
  
  <pre><code>mat = [  2009 3 ;
           2010 2 ] ;
  </code></pre>
  
  <p>I need to repeat the Col1 as per Col2.  The solution at <a href="https://stackoverflow.com/questions/1975772/matlab-array-manipulation">Repeat copies of array elements: Run-length decoding in MATLAB</a> is helpful.  However, my main problem is to then increment the years according, as in:</p>
  
  <pre><code>Ansmat = [  2009 3
              2010 3
              2011 3
              2010 2
              2011 2 ] ;
  </code></pre>
  
  <p>I want to avoid a <code>for</code> loop here.  Thanks for your help!  This would be a great help!</p>