total number of elements which are not zero

2 vues (au cours des 30 derniers jours)
Mate 2u
Mate 2u le 20 Juil 2012
I have a matrix "Percey" of size 294x34. I want a new matrix "B" which is 294x1 where each row the number of numbers which are not 0 are counted.
Thanks

Réponse acceptée

Wolfgang Schwanghart
Wolfgang Schwanghart le 20 Juil 2012
Hi, what about:
B = sum(Percey~=0,2);
Regards, W.

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by