Using the C++ Math Library    

Evaluating Arrays for Sparse Storage

To see if a MATLAB array is a good candidate for sparse format storage, determine the number of nonzero elements in an array, using the nnz() routine. The following code fragment creates a 5-by-5 identity matrix and then obtains the number of nonzero elements in the identity matrix.


 Converting a Sparse Matrix to Full Matrix Format Character Arrays