MATLAB: How to display a value in first column the second column number of times

displying the valuesreplem alternative

suppose i have a column vector x=[1 2 3 4]; and y=[2 3 3.5 4]
i want the output as xy=[1 1 2 2 2 3 3 3 3 4 4 4 4];
the number 3.5 can be rounded off to a whole number. here ive taken it as 4.

Best Answer

repelem(x, round(y))