Mathematics    

The find Function and Sparse Matrices

For any matrix, full or sparse, the find function returns the indices and values of nonzero elements. Its syntax is

find returns the row indices of nonzero values in vector i, the column indices in vector j, and the nonzero values themselves in the vector s. The example below uses find to locate the indices and values of the nonzeros in a sparse matrix. The sparse function uses the find output, together with the size of the matrix, to recreate the matrix.


  Viewing Sparse Matrices Graphically Example: Adjacency Matrices and Graphs