How i can create a n+1 column matrix from n column matrix?

조회 수: 1 (최근 30일)
suchismita
suchismita 2015년 4월 23일
댓글: suchismita 2015년 4월 24일
i have a matrix 10*n, for example, let n=3
a= [ 1 2 3
1 2 4
1 2 5
1 3 4
1 3 5
1 4 5
2 3 4
2 3 5
2 4 5
3 4 5]
i want to create another matrix n+1
b=[1 2 3 4
1 2 3 5
1 2 4 5
1 3 4 5
2 3 4 5]
this is obtained from a as
{1 2 3} and from
{1 2 4}
{1 2 3 4} is created, where no pair must repeat and
{1 2 3} or
{1 2 4} or
{2 3 4}
all pair must be present in a or delete that pair.
please please help me.
i want to know how i can obtain a 4 column matrix from 3 column matrix, if i want 5 column from 4 column matrix then where is the main change in code.
please help me.

채택된 답변

Roger Stafford
Roger Stafford 2015년 4월 23일
It looks to me as if you need to use:
b = nchoosek(1:5,4);

추가 답변 (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