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 Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by