MATLAB: Rows which do not contain zero

matrixzeros

Hi all, I have a matrix D = 294×34. I want to output the number of rows which which may contain a number (so I want the the number of rows which are not all zeros).
Thank you.

Best Answer

row = any(D,2);
rowCount = sum(row); %number of rows with non-zero elements