[SciPy-User] scipy.io.matlab.loadmat error

Fernando Guimarães Ferreira fernando.ferreira at poli.ufrj.br
Mon May 31 22:43:40 EDT 2010


14 [fguimara] script > uname -a
Darwin warley.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09
PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
15 [fguimara] script > ipython
Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import scipy

In [2]: scipy.__version__
Out[2]: '0.7.2'

In [3]: import scipy.io.matlab

In [4]: scipy.io.matlab.loadmat('teste.mat')
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/io/matlab/mio.py:84:
FutureWarning: Using struct_as_record default value (False) This will change
to True in future versions
  return MatFile5Reader(byte_stream, **kwargs)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/fguimara/Documents/UFRJ/mestrado/CPE782_-_ICA/time_series_ica/script/<ipython
console> in <module>()

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/io/matlab/mio.pyc
in loadmat(file_name, mdict, appendmat, **kwargs)
    109     '''
    110     MR = mat_reader_factory(file_name, appendmat, **kwargs)
--> 111     matfile_dict = MR.get_variables()
    112     if mdict is not None:
    113         mdict.update(matfile_dict)

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/io/matlab/miobase.pyc
in get_variables(self, variable_names)
    444         mdict['__globals__'] = []
    445         while not self.end_of_stream():
--> 446             getter = self.matrix_getter_factory()
    447             name = getter.name
    448             if variable_names and name not in variable_names:

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/io/matlab/mio5.pyc
in matrix_getter_factory(self)
    694
    695     def matrix_getter_factory(self):
--> 696         return self._array_reader.matrix_getter_factory()
    697
    698     def guess_byte_order(self):

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/io/matlab/mio5.pyc
in matrix_getter_factory(self)
    313         elif not mdtype == miMATRIX:
    314             raise TypeError, \
--> 315                   'Expecting miMATRIX type here, got %d' %  mdtype
    316         else:
    317             getter = self.current_getter(byte_count)

TypeError: Expecting miMATRIX type here, got 1296630016

In [5]:


Same file.... But it doesnot work at all...


Cheers,
Fernando




On Mon, May 31, 2010 at 11:38 PM, Pierre GM <pgmdevlist at gmail.com> wrote:

> On May 31, 2010, at 10:09 PM, Vincent Davis wrote:
> > Just as a note, this probably is not it  but I recently ran into this
> > with a csv file saved using excel on a mac. I guess it saves it as a
> > unicode format, the error reported is a EOL when opening with
> > genfromtxt but thats not quite right.
>
>  But I thought I had fixed that on the SVN ???
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20100531/1449a509/attachment.html>


More information about the SciPy-User mailing list