ISSPARSE Test for Sparse Matrix
Section: Inspection Functions
Usage
Test a matrix to see if it is sparse or not. The general format for its use isy = issparse(x)
This function returns true if x
is encoded as a sparse
matrix, and false otherwise.
Example
Here is an example of usingissparse
:
--> a = [1,0,0,5;0,3,2,0] a = 1 0 0 5 0 3 2 0 --> issparse(a) ans = 0 --> A = sparse(a) A = 1 1 1 2 2 3 2 3 2 1 4 5 --> issparse(A) ans = 1