how to prevent of repeated permutation

조회 수: 1 (최근 30일)
Niki
Niki 2012년 6월 6일
I have written this
X =rand (4,2)
t= size (X);
permlimit = 100;
M2 = zeros([permlimit, t(2)]);
for ii = 1 : permlimit
for jj = 1 : t(2)
M2(ii,jj) = X(randi(t(1)),jj);
end
end
But in out put I have some similar result, I do not want to have, how to prevent having them ? for example I will have in my results M2 =
0.3897 0.1171
0.3335 0.1604
0.3335 0.1171
0.3337 0.1604
0.3897 0.5503
0.3337 0.1171
0.3897 0.1604
0.3337 0.1604
0.3337 0.1604
As you see some of results are the same like
0.3337 0.1604
0.3337 0.1604
  댓글 수: 1
Andrei Bobrov
Andrei Bobrov 2012년 6월 6일
Number permutation for matrix with size 4x2 in your case: 16, ie will repeated rows

댓글을 달려면 로그인하십시오.

채택된 답변

Thomas
Thomas 2012년 6월 6일
unique(M2,'rows')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by