How to remove zero sum row from matrix
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Vishal Sharma
le 24 Jan 2017
Réponse apportée : Andrei Bobrov
le 24 Jan 2017
A=[1 2 3 4 5 6;
0 0 1 1 0 1;
0 0 1 0 1 0]
Sum of second and third row if equal to zero, then in new matrix that column is to be excluded. So, the result shall be
A=[3 4 5 6;
1 1 0 1;
1 0 1 0]
0 commentaires
Réponse acceptée
the cyclist
le 24 Jan 2017
Modifié(e) : the cyclist
le 24 Jan 2017
colToRemove = sum(A(2:end,:))==0;
A(:,colToRemove) = [];
1 commentaire
Plus de réponses (2)
Voir également
Catégories
En savoir plus sur Creating and Concatenating 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!