Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
suchismita
suchismita le 23 Avr 2015
Commenté : suchismita le 24 Avr 2015
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.

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by