필터 지우기
필터 지우기

permutation of numbers when repetition of digits is allowed.

조회 수: 1 (최근 30일)
salim
salim 2012년 12월 5일
I want to have all permutation of 3 numbers when repetition of digits are allowed.How can i have them in matrix?Am i supposed to program it or not?
Regards

채택된 답변

Jan
Jan 2012년 12월 5일
편집: Jan 2012년 12월 5일
index = [1,1,1; 1,1,2; 1,1,3; ...
1,2,1; 1,2,2; 1,2,3; ...
1,3,1; 1,3,2; 1,3,3; ...
2,1,1; 2,1,2; 2,1,3; ...
2,2,1; 2,2,2; 2,2,3; ...
2,3,1; 2,3,2; 2,3,3; ...
3,1,1; 3,1,2; 3,1,3; ...
3,2,1; 3,2,2; 3,2,3; ...
3,3,1; 3,3,2; 3,3,3];
data = [4, 17, 21];
result = data(index);
No need to program this for such a tiny set. For larger sets search in the FileExchange for the term "permutation" and "combination".

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by