I want a loop that executes at one time only several combinations.
x = [1 2 3 4 5];
xp = randperm(numel(x), 2);
x(xp) = x(fliplr(xp))
>> test
x =
1 2 4 3 5
>> test
x =
1 3 2 4 5
MATLABpermute in matlab
1 2 4 3 5
1 3 2 4 5
Best Answer