[SciPy-user] io.loadmat

Nils Wagner nwagner at mecha.uni-stuttgart.de
Wed Oct 15 08:33:37 EDT 2003


Travis Oliphant schrieb:
> 
> Loadmat will only read mat files saved using the MATLAB version 4 file
> format.  You can save mat files in MATLAB in this format using the -v4
> switch when you enter the save command (do a help save in MATLAB for
> information).  There is no reason we couldn't read the MATLAB version 5
> format --- it's documented on the web.  But, it is significantly more
> complicated and nobody has spent the time to write it.  Perhaps you
> could write it.
> 
> -Travis
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user

Travis,

Thank you for your workaround. However, the current version of loadmat
cannot handle sparse matrices ?
Is there any progress in importing sparse matrices ? 

Traceback (most recent call last):
  File "matlab.py", line 4, in ?
    io.loadmat("k00.mat",appendmat=0)
  File "/usr/local/lib/python2.1/site-packages/scipy/io/mio.py", line
423, in loadmat
    raise ValueError, "Cannot handle sparse matrices, yet."
ValueError: Cannot handle sparse matrices, yet.

So I guess, I have to use 

k00=full(k) 

in Matlab before I use 

save -mat -v4 k00

Nils



More information about the SciPy-User mailing list