MATLAB: Find sum of all the entries with value 0

I have a cell matrix of mat = [ 1 0 0 4;0 2 0 4], i want to find the sum of the all the entries having value 0. in the case of given example the entries having count 0 are 4; so sum will be 4. how can i do this.

Best Answer

sum(~mat(:))