Copy numbers vector to vector
41 views (last 30 days)
Hello! If I have a vector and I need to copy some numbers from another vector how can I do it?
For example, this is what I've done:
v1= v1 is another vector and I want to copy in the 'graph1' (on the positions 50 to 51), the numbers of the vector v1 in the position 240:245.
thanks a lot,
Daniel Shub on 3 Aug 2012
Edited: Daniel Shub on 3 Aug 2012
You need to read the documentation. This is really a simple problem and your code is close.
v1 = randn(1, 255); % We need this in order to do the copy
graph1= zeros(1, 100); % Note this is not 1:100
graph1(i1:i2)=v1(240:245); % Your code had I, which you never describe.