function n = nz(f)
%
% nz: returns number of non-zero elements of 2d matrix
% On input:
%     f: 2D array
% On output:
%     n: number of non-zero elements
% Call:
%     n = nf(f)
%

[m,n] = size(f);

temp = (f ~= zeros(m,n));

n = sum(sum(f));