How to form a matrix from a given matrix?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
suchismita
le 14 Juil 2015
Réponse apportée : Guillaume
le 14 Juil 2015
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....
0 commentaires
Réponse acceptée
Guillaume
le 14 Juil 2015
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Resizing and Reshaping Matrices 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!