MATLAB: I need the best way to write the loop commands

for loop

for i=1:15,
y(i+1)=vec(i);
end
y(1)=vec(16);

Best Answer

y = vec([16, 1:15]);