MATLAB: Nested loop problem !

nested loop

Hey every1.. I am working on arrays and I am finding it quite confusing and slowly getting it.. I want to replace the content of a double array with another double array and I belive since is double I should use a nested loop but I am not sure how it works?? I tried several of ways which is below but the content is not being replaced.. I keep checking it from the matlab work space .. My code is below.. the size is 2×100 and in matlab workspace is two rows.. with my code instead of replacing the content it adds extra row to array b?? I want to start the replace from a(3,1) with b(1,1). a(4,1) with b(2,1) etc then when it finishes this row the second row etc
a(x;y)
b(s,f)
d = 2;
for i=3,j=1:100
a(i,j) = b(i -d,j);
i = i+1;
j = j+1
end
Thanks in advance !!

Best Answer

Will this do what you are looking for:
EDIT:
a(:,3:end) = b(:,1:end-2);
OR, if you really wanted a for loop:
d = 2;
for i=1:100-d
a(:,i+2) = b(:,i);
end
-Nathan