I want to copy values from one variable to another

j=1;
V=[0 1 2 4 5 6 7 9 10 11 52 10 2 0 60 4 0 407 0 7 70];
for i=1:1:15
v=V(:,j:(j+3));
I want v=[0 1 2] in first iteration n so on.But values are not coming in proper order. Any other method for doing this??

More Answers (1)

V=[0 1 2 4 5 6 7 9 10 11 52 10 2 0 60 4 0 407 0 7 70];
M=[V(1:end-2)' V(2:end-1)' V(3:end)']

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!