[SciPy-user] reading .mat-files (Matlab 7)
Rob Clewley
rhc28 at cornell.edu
Wed Jul 25 11:05:28 EDT 2007
Stefan,
scipy.io.loadmat from scipy 0.5.2 doesn't work on anything but v4
files for me. I generated extremely simple mat files (one small matrix
in 'test.mat') with my matlab 7.3 using the -v6, -v5, and -v4 options,
and scipy complained with this in all but the -v4 case:
In [1]: import scipy.io as io
In [2]: io.loadmat('test')
---------------------------------------------------------------------------
exceptions.AttributeError Traceback (most
recent call last)
c:\temp\<ipython console>
C:\Python24\lib\site-packages\scipy\io\mio.py in loadmat(file_name, mdict, appen
dmat, basename, **kwargs)
94 '''
95 MR = mat_reader_factory(file_name, appendmat, **kwargs)
---> 96 matfile_dict = MR.get_variables()
97 if mdict is not None:
98 mdict.update(matfile_dict)
C:\Python24\lib\site-packages\scipy\io\miobase.py in
get_variables(self, variable_names)
267 variable_names = [variable_names]
268 self.mat_stream.seek(0)
--> 269 mdict = self.file_header()
270 mdict['__globals__'] = []
271 while not self.end_of_stream():
C:\Python24\lib\site-packages\scipy\io\mio5.py in file_header(self)
508 hdict = {}
509 hdr = self.read_dtype(self.dtypes['file_header'])
--> 510 hdict['__header__'] = hdr['description'].strip(' \t\n\000')
511 v_major = hdr['version'] >> 8
512 v_minor = hdr['version'] & 0xFF
AttributeError: 'numpy.ndarray' object has no attribute 'strip'
This is with numpy 1.0.2. I wonder if this is the problem that Oliver has?
-Rob
On 25/07/07, Stefan van der Walt <stefan at sun.ac.za> wrote:
> Hi Oliver
>
> On Wed, Jul 25, 2007 at 01:06:18PM +0200, oliver.tomic at matforsk.no wrote:
> > Is there now support in scipy.io (scipy 0.52) for reading .mat-files from
> > Matlab 7? I undestand that it supports older versions (v4 and v5). Are
> > there any plans to support for Matlab 7 .mat-files?
>
> >From the docstring:
>
> "v4 (Level 1.0), v6 and v7.1 matfiles are supported."
>
> Cheers
> Stéfan
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
More information about the SciPy-User
mailing list