MATLAB: Check at least one element is not zero in each row

matrix manipulation

Hello,
The aim is to check in a large matrix A, there is at least one element is not zero in each row. I understand the normal method is
for i = 1: numberOfRow
% check at least one element is not zero
end
But this is going really slow.
Is there a smart way to verify it?
Thanks in advance.

Best Answer

any(A,2)