For loop without repetition

조회 수: 3 (최근 30일)
Brad Antman
Brad Antman 2019년 10월 10일
편집: Rik 2019년 10월 10일
Hello,
I need to create a loop that loops through 3 gas components but they cannot be put together. Basically i need to be able to use a nested for loop to get 1 and 3, 1 and 2, 2 and 3 but cannot have 1 and 1, 2 and 2 or 3 and 3... any help would be appreciated

답변 (1개)

Rik
Rik 2019년 10월 10일
편집: Rik 2019년 10월 10일
Use perms to generate the list of all combinations and loop through the rows. Use nchoosek if you need unique combinations.

카테고리

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