how to combine two matrix?
조회 수: 1 (최근 30일)
이전 댓글 표시
example1=[25 20 30 40 50 60 70 80 90];
ex_perm = reshape((perms(example1))', 1,size(example1,2),[]);
I want [example1; ex_perm] format.
Means 1*9*362881 Matrix.
댓글 수: 0
채택된 답변
Walter Roberson
2016년 2월 9일
That is not combining two matrices. The code you show looks like it would work. An easier way of doing that would be
ex_perm = permute(perms(example1), [3 2 1]);
댓글 수: 2
Walter Roberson
2016년 2월 9일
Ah, I did not notice that you wanted another copy of example1 in there. Note that the original form of example1 will already be included in the list, so only do this if you do not mind having a duplicate entry.
One way:
permute([example1; perms(example1)], [3 2 1])
Another:
ex_perm = permute(perms(example1), [3 2 1]);
result = cat(3, example1, ex_perm);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!