I have a 2 year column in Matlab as shown below:
% Col2 Is always greater than Col1
mat = [2009 2012 ;
2012 2012 ;
2012 2013 ;
I need to do 2009: 2012 for row1, 2012: 2012 for row2, etc ... This is not very simple, since the size 1: N continues to change for each pair.
FinalAns = [ 2009
2010
2011
2012 % --
2012 % --
2012
2013 ] ; % --
I cannot use the 'for' loop, because the data size is very large, and I could not use it for this accumarray. A vectorized solution would be highly appreciated.
Maddy source
share