"Roger Stafford" wrote in message <email@example.com>... > - - - - - - - - - - - > Let c be a row vector which gives the initial value of each column integer range together with a final element which is 1 greater than the end of the last range. (In your example it would be as below.) > > c = [0,3,5,8,12,23,25,27,40,53]; > n = length(c)-1; > m = 40; > M = floor(repmat(diff(c),m,1).*rand(m,n))+repmat(c(1:n),m,1); > > M is your desired matrix. > > Roger Stafford
Thank you very much! This is exactly what I was looking for!