필터 지우기
필터 지우기

How to form a matrix from a given matrix?

조회 수: 1 (최근 30일)
suchismita
suchismita 2015년 7월 14일
답변: Guillaume 2015년 7월 14일
I have a matrix as
A=[1 3
5 4]
I want to form a matrix with all possible pairs for example
B=[1 3 4
1 3 5
3 4 5]
where, B is obtained from A with all elements of A and formed a 3 collumn matrix.
please please help me....

채택된 답변

Guillaume
Guillaume 2015년 7월 14일
A = [1 3; 5 4]; %Note that it does not make sense to have A as a matrix.
%A = [1 3 4 5] would make more sense.
B = nchoosek(A(:), 3)

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by