MATLAB: Total number of elements which are not zero

zeros

I have a matrix "Percey" of size 294×34. I want a new matrix "B" which is 294×1 where each row the number of numbers which are not 0 are counted.
Thanks

Best Answer

Hi, what about:
B = sum(Percey~=0,2);
Regards, W.