[SciPy-User] scipy.io.loadmat error when trying to read a .mat file

Matthew Brett matthew.brett@gmail....
Tue Oct 12 14:34:52 CDT 2010


> Many thanks. I'll test this out as soon as I can. I think for now I will go with the MatFile5Reader approach and just load the variables I need, since from what I understand this approach will work with the current version of scipy. I need to deploy this script across several users and I prefer to install release versions of Scipy on their machines. I'll transition to loadmat once that makes it into the stable release.

Ah - no - so there are three separate problems in your example file:

a) Duplicate variable names
b) Strings that have declared length > 0, and allocated storage of 0.
c) Structs with duplicate fieldnames.

For a) you can do something about this in current scipy if you want
the first (rather than the last) version of a particular variable, by
doing the MatFileReader trick.  But that's your smallest problem
because b) and c) crash the scipy reader.    So, you can probably pull
out any variables not suffering from b) or c), but that's all - with
current scipy.

> Will these fixes make it into the next release of scipy?

Yes, they should be.  I will push them into the current svn version
for others to try and we'll see what damage I have done ;)



More information about the SciPy-User mailing list