MATLAB: How to repeat different numbers in a row

conciseMATLABmatrixrepetitionrows

I need to find a more concise way of repeating different numbers, each a different number of times in a row.
My current row (1×45 matrix) contains 15 8 times, 4 10 times, 5 8 times, 12 6 times, 4 6 times, 5 3 times and 12 4 times
i.e. my current matrix looks like:
A = [15 15 15 15 15 15 15 15 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 12 12 12 12 12 12 4 4 4 4 4 4 5 5 5 12 12 12 12]
Is there a more concise way I can code this data to produce this matrix?

Best Answer

the repelem (link) function (R2015a and later versions) is likely the easiest way to do what you want.
A = repelem([15 4 5 12 4 5 12], [8 10 8 6 4 3 4])