[SciPy-User] scipy.io.loadmat error when trying to read a .mat file
Tue Oct 12 08:12:23 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.
Will these fixes make it into the next release of scipy?
>>> Matthew Brett <email@example.com> 10/12/2010 1:51 AM >>>
> You can already specify a variable name (not a regexp), so for example:
> from scipy.io.matlab.mio5 import MatFile5Reader
> rdr = MatFile5Reader(open('20100819125947.mat', 'rb'))
> var = rdr.get_variables(['System'])
> will already return you the first 'System' variable, that would
> otherwise be overwritten when you read the full set of variables. You
> are right, that should be in the loadmat API somewhere.
Actually, I just did add that - in the same branch ('mio-read-fix')
In : import scipy.io as sio
In : vars = sio.loadmat('20100819125947.mat', variable_names=['System'])
will return just the first occurrence of a variable named 'System' in the file.
SciPy-User mailing list
More information about the SciPy-User