Count percentage of zero elements of a matrix

1 view (last 30 days)
Hi,
I want to count the percentage of zero elements of a matrix. For an example, I have matrix 3x3
M = [1 1 0 1 0 0 0 0 0]
Can anyone help me with Matlab code?I'm a newbie with Matlab. Tq

Accepted Answer

Walter Roberson
Walter Roberson on 7 Jul 2013
Hint: look at nnz()

More Answers (0)

Community Treasure Hunt

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

Start Hunting!