function nz = nonzero(s)
% returns number of non-zero elements
%    nz = nonzero(s)

[m,n] = size(s);
nz = sum(sum(s ~= zeros(m,n)));
