I have a matrix:
mat = [ 2009 3 ;
2010 2 ] ;
I need to repeat the Col1 as per Col2. The solution at Repeat copies of array elements: Run-length decoding in MATLAB is helpful. However, my main problem is to then increment the years according, as in:
Ansmat = [ 2009 3
2010 3
2011 3
2010 2
2011 2 ] ;
I want to avoid a for
loop here. Thanks for your help! This would be a great help!