function res = repeat1(m) [r, c] = size(m); for i = 1 : r %Go through each row for j = 1 : m(i, 2) %Repeat the number of times specified in the second column res(end + 1) = m(i, 1); end end