Hi,,I am trying to calculate the weight of a matrix.how can i do that> I am explaining below
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
nafila aytija
le 31 Mai 2016
Commenté : the cyclist
le 2 Juin 2016
Suppose I have a matrix...
A = [1 0 0 0 ;
1 1 0 0 ;
1 1 1 0 ;
1 1 1 1]
how do I calculate that how many coulmns have only one ONE ? TIA
0 commentaires
Réponse acceptée
the cyclist
le 31 Mai 2016
numberOfColumnsThatHaveExactlyOneOne = sum(sum(A==1)==1);
3 commentaires
the cyclist
le 2 Juin 2016
numberOfRowsThatHaveExactlyOneOne = sum(sum(A==1,2)==1,1);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB 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!