Let's say I have this array:
1 2 3 4
and I want to create an array like this:
1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
How could I create that?
Let's say I have this array:
1 2 3 4
and I want to create an array like this:
1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
How could I create that?
From the documentation for repelem
:
repelem Replicate elements of an array. U = repelem(V,N), where V is a vector, returns a vector of repeated elements of V.
So what you want is:
>> repelem([1 2 3 4],4)