MATLAB: How to get permutation of each rows of matrix

permutation of rows

hi
I want to get a matrix which consists all permutation of each rows of previous matrix… For example,
A =
1 2 2
2 2 3
result =
1 2 2
2 1 2
2 2 1
2 2 3
2 3 2
3 2 2

Best Answer

out = [];
for j1 = 1:size(A,1)
out = [out;unique(perms(A(j1,:)),'rows')];
end
Related Question