필터 지우기
필터 지우기

How to find combination of random number of vectors?

조회 수: 1 (최근 30일)
Xiaohan Du
Xiaohan Du 2017년 10월 30일
댓글: Star Strider 2017년 10월 30일
Hi all,
Function combvec gives the combination of n vectors. Imagine I have a cell C contains m vectors, how can I find combination of all m vectors without manually input all of them in combvec?
I think I can do this:
C = {[1 2 3] [2 3 4 5] [9 8 2]};
for i = 1:2
output = combvec(C{i}, C{i + 1});
end
but it only gives me combination of last 2 vectors. Any ideas?

채택된 답변

Star Strider
Star Strider 2017년 10월 30일
Save the results in a cell array:
C = {[1 2 3] [2 3 4 5] [9 8 2]};
for i = 1:2
output{i} = combvec(C{i}, C{i + 1});
end
  댓글 수: 4
Xiaohan Du
Xiaohan Du 2017년 10월 30일
Oh, this is really interesting, thanks!
Star Strider
Star Strider 2017년 10월 30일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by