MATLAB: Plotting sparsity pattern of a matrix

sparsity matrix spy()

Hi Guys,
I want to visualize the sparsity pattern of a sparse matrix using the function spy().All elements in this matrix is approximated to 4th digit (example : 0.0031,0.0000). The spy() function does not identify 0.0000 or -0.0000 s as absolute zeros. I mean the pattern seems to be dense. How can I overcome this issue? please help me.

Best Answer

spy(abs(yourMatrix)>=0.0001)