I have a vector that has N=1263
entries:
temp=[14, 0.5, ..., 12]
I want to make a vector which repeats entry 1, i.e. 14
, 42 times, then entry 2, i.e. 0.5
, 42 times and similarly all through the vector. It should produce a vector with size 53046x1.
The following code does the work for a simple case:
F = [1 4 9];
R = [repmat(F(1),[3,1]); repmat(F(2),[3,1]); repmat(F(3),[3,1])]
R = [1 1 1 4 4 4 9 9 9]
but it is cumbersome when N
becomes large. Is there a faster way around this?