I have a vector in Matlab A of dimension mx1 reporting the natural integers from 1 to m in increasing order, e.g. A=[1 2 3]'.
Let B be a vector of dimension mx1 reporting some natural integers greater or equal than zero, e.g. B=[1 3 0]'.
Without using loops, I want to construct a vector C of dimension sum_i(B(i)) obtained by listing each A(i) B(i) times. In the example
C=[1 2 2 2].