Reputation: 15
Let us assume a simple array A
A = [1 2 3 4 5 6 7 8];
I would like to create an array B
that will contain the A
as many as 2 times:
B = [A A]
Then B
, will be of dimensions (1,2*length(A))
How can I do the same, but for N
times (e.g. using a for loop or something like this)?
for i = 1:N
B = ???
end
so that
B = [A A A.....A]
I tried repmat
to make first the B
as a matrix, and then reshape
. However reshape
does not work as I was expecting and instead of giving:
1 2 3 4 5 6 7 8 1 2 3 4
5 6 7 8
it gave:
1 1 2 2 3 3 4 4 5 5 6 6
7 7 8 8
Upvotes: 0
Views: 391