I have a simple question about how can I copy a vector into another. I have a vector with a length of 66×1 and then, another with a length of 2151×1. I want to copy the values from the first one in a exactly position on the other. I’ve tried that but it doesn’t work.
inter= 66×1
out= 2151×1
for i=1:numel(inter)
out(101:167)= inter(i)
end
Also I’ve tried this:
for inter=(1:66);
out(101:167)=inter;
end
And this:
for k= (101:167)
out(k)=inter(1:66);
end
Am I doing wrong? Thanks in advance,
Let’s say your vectors are
for simplicity.
There is no need to use loops. You can just go ahead and do it like this:
Then b would be:
A very important point here is the
-1infinalIdx. You need to substract 1 from the final index.