for loop to show all alternatives

조회 수: 1 (최근 30일)
Hassan
Hassan 2012년 8월 3일
i need to write for loop to print all the alternatives such as.
i have N nodes (10) and need to store all their alternatives in an array is K (4);
1 2 3 4; 1 2 3 5; 1 2 3 6; 1 2 3 7; 1 2 3 8; 1 2 3 9; 1 2 3 10; 1 2 4 5; 1 2 4 6; 1 2 4 7; 1 2 4 8; 1 2 4 9; 1 2 4 10; . . . . thanks & BR
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2012년 8월 3일
Is a for loop mandatory?

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

답변 (1개)

Oleg Komarov
Oleg Komarov 2012년 8월 3일
nchoosek(1:10,4)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by