I am trying to change the order of a vector [ 1 2 3 4 5 6] into [ 3 4 5 1 2 6] while using a determinative vector B=[ 3 4 5],
but when I run the code I get a vector [3 4 5 2 1 6];
x == numfor i = 1:length(B) if isequal(B(i),num(i)) == 0 tmp = num(i); num(i) = num(B(i)); num(B(i)) = tmp; endend
Best Answer