total number of elements which are not zero

조회 수: 1 (최근 30일)
Mate 2u
Mate 2u 2012년 7월 20일
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

채택된 답변

Wolfgang Schwanghart
Wolfgang Schwanghart 2012년 7월 20일
Hi, what about:
B = sum(Percey~=0,2);
Regards, W.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by