In matlab I have two vectors, ind and ind3. ind = [1 2 3 4 5] and I want to define ind3 based on ind such that I want ind(3), ind(4) and ind(5) to be ind3(1) and ind3(2) and ind3(3). so that ind3 = [ind(3) ind(4) ind(5)] but for some reason I can't do this. I thought it would be simple to do using nested for loops but it doesn't really work.
for i=3:5
for n=1:3
ind3(n,:) = ind(i,:);
end
end
By going through the for-loops logically I know why the output is wrong.. but I don't get how else to do it? Am I being stupid and missing something really simple?!
I know its probably a simple answer but can anybody help??
Thanks.
ind3(1:3,:)=ind(3:5,:)