User`s guide
mwSize NumberOfNonZeros() const
Purpose Return num ber of nonzero elements for sparse array
C++
Syntax
#include "mclcppclass. h"
mwArray a(2, 2, mxDOUBLE_CLASS);
int n = a.NumberOfNonZeros ();// Should return 4
Arguments None
Return
Value
Actual number of n onzero elements in array.
Description Usethismethodtodeterminethesizeoftheofthearray’sdata. If
the underlying array is not sparse, this returns the same value as
NumberOfElements().
Note This meth od does not analyze the actual values of the array
elements. Instead, it returns the number of elements that could
potentially be nonzero. This is exactly the number of elements for which
the sparse m atrix has allocated storage.
C-52