Re: Assigning a vector from a repeated vector



In article <ef3187c.-1@xxxxxxxxxxxxxxxx>, "raphael vilamiu"
<raphaelvilamiu@xxxxxxxxxxxx> wrote:

I need to assign a vector v1 as being a vector v2 repeated length(v3)
times. My naive solution is:

v1 = [];
for(i = 1:length(v3))
v1 = [v1 v2];
end

Is there a better (shorter, cleaner) way of doing this?

Thanks in advance

Vilamiu
--------------
Make use of the 'repmat' function.

(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
.



Relevant Pages