Effacer les filtres
Effacer les filtres

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)
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

Réponse acceptée

the cyclist
the cyclist le 31 Mai 2016
numberOfColumnsThatHaveExactlyOneOne = sum(sum(A==1)==1);
  3 commentaires
nafila aytija
nafila aytija le 2 Juin 2016
Is it possible to do the same with the rows?? TIA
the cyclist
the cyclist le 2 Juin 2016
numberOfRowsThatHaveExactlyOneOne = sum(sum(A==1,2)==1,1);

Connectez-vous pour commenter.

Plus de réponses (0)

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!

Translated by