FreeMat: FULL Convert Sparse Matrix to Full Matrix

FreeMat

- Main Page
- Related Pages

FULL Convert Sparse Matrix to Full Matrix

Section: Sparse Matrix Support

# Usage

Converts a sparse matrix to a full matrix. The syntax for its use is

       y = full(x)

The type of `x` is preserved. Be careful with the function. As a general rule of thumb, if you can work with the `full` representation of a function, you probably do not need the sparse representation.

# Example

Here we convert a full matrix to a sparse one, and back again.

    --> a = [1,0,4,2,0;0,0,0,0,0;0,1,0,0,2]

    a =
     1 0 4 2 0
     0 0 0 0 0
     0 1 0 0 2

    --> A = sparse(a)

    A =
     1 1 1
     3 2 1
     1 3 4
     1 4 2
     3 5 2
    --> full(A)

    ans =
     1 0 4 2 0
     0 0 0 0 0
     0 1 0 0 2