|MATLAB Function Reference|
Import matrix from sparse matrix external format
spconvert is used to create sparse matrices from a simple sparse format easily produced by non-MATLAB sparse programs.
spconvert is the second step in the process:
[i,j,re,im]as rows into a MATLAB variable.
S = spconvert(D)
converts a matrix
D with rows containing
[i,j,r,s] to the corresponding sparse matrix.
D must have an
nnz+1 row and three or four columns. Three elements per row generate a real matrix and four elements per row generate a complex matrix. A row of the form
0] anywhere in
D can be used to specify
D is already sparse, no conversion is done, so
spconvert can be used after
D is loaded from either a MAT-file or an ASCII file.
Suppose the ASCII file
Then the statements
sparse(triu(hilb(4))), possibly with roundoff errors. In this case, the last line of the input file is not necessary because the earlier lines already specify that the matrix is at least 4-by-4.