calculating combinations of two vectors simultanously?
조회 수: 1 (최근 30일)
이전 댓글 표시
I am a beginner so would you please explain the easiest, the most straightforward methods to calculate combinations of more than one vector simultanously?
a=[1, 3, 5, 7, 9] and b=[2, 4, 6, 8, 10] I would like to calculate the (a,3) and (b,3) simultanously and the results should be combined. How can I do it instead of doing nchoosek(a,3) and nchoosek(b,3) I would like to do it in less steps, if possible one step.
Thank you.
댓글 수: 1
답변 (2개)
Jan
2021년 9월 8일
a = [1, 3, 5, 7, 9];
b = [2, 4, 6, 8, 10];
index = nchoosek(1:numel(a), 3);
a(index)
b(index)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!