[SciPy-user] Sparse format support in io.loadmat

Nils Wagner nwagner at mecha.uni-stuttgart.de
Thu Oct 7 07:06:01 CDT 2004


Nils Wagner wrote:

> Hi all,
>
> AFAIK there is no support for reading sparse matrices via
> io.loadmat.
>
> Traceback (most recent call last):
>  File "io.py", line 2, in ?
>    print io.loadmat('test.mat', appendmat=0)
>  File "/usr/lib/python2.3/site-packages/scipy/io/mio.py", line 744, in 
> loadmat
>    raise ValueError, "Cannot handle sparse matrices, yet."
> ValueError: Cannot handle sparse matrices, yet.
>
> Since io has many new features e.g. Matrix  Market
> (and hopefully NASTRAN's op4 in the near future) it would be nice to have
> support for sparse matrices in io.loadmat.
>
> Any comments ?
>
> Nils
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user

Just now, I tried to read a matlab version 5 sparse matrix.

 Traceback (most recent call last):
 File "io.py", line 3, in ?
 d1= io.loadmat('test.mat', appendmat=0) File 
"/usr/lib/python2.3/site-packages/scipy/io/mio.py", line 692, in loadmat
 thisdict = _loadv5(fid,basename)
 File "/usr/lib/python2.3/site-packages/scipy/io/mio.py", line 631, in 
_loadv5
 el, varname = _get_element(fid)
 File "/usr/lib/python2.3/site-packages/scipy/io/mio.py", line 619, in 
_get_element
 el, name = _parse_mimatrix(fid,numbytes)
 File "/usr/lib/python2.3/site-packages/scipy/io/mio.py", line 568, in 
_parse_mimatrix
 spmat = scipy.sparse.spmatrix(dims[1],dims[0],typecode=res.typecode())
TypeError: __init__() got an unexpected keyword argument 'typecode

Nils




More information about the SciPy-user mailing list