Say I have the following vector:
a = [200, 150, 100, 80, 60, 50, 40, 38, 30, 20, 10]
Is there a function in MATLAB that allows me to generate all 55 possible combinations i.e.
200 & 150; 200 & 100; 200 & 80; 200 & 60; ... 30 & 20; 30 & 10; 20 & 10.

 채택된 답변

Roger Stafford
Roger Stafford 2016년 11월 6일

0 개 추천

You can use ‘nchoosek’ for that task:
C = nchoosek(a,2);

추가 답변 (0개)

카테고리

태그

아직 태그를 입력하지 않았습니다.

질문:

2016년 11월 6일

답변:

2016년 11월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by