FreeMat: ISSPARSE Test for Sparse Matrix

FreeMat

- Main Page
- Related Pages

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 is

       y = issparse(x)

This function returns true if `x` is encoded as a sparse matrix, and false otherwise.

# Example

Here is an example of using `issparse`:

    --> 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