[Scipy-tickets] [SciPy] #1348: loadmat not returns numpy format

SciPy Trac scipy-tickets@scipy....
Sun Dec 12 19:36:22 CST 2010


#1348: loadmat not returns numpy format
----------------------------+-----------------------------------------------
 Reporter:  Krzysiaczek     |       Owner:  somebody
     Type:  defect          |      Status:  new     
 Priority:  high            |   Milestone:  0.9.0   
Component:  scipy.io        |     Version:  0.8.0   
 Keywords:  loadmat, numpy  |  
----------------------------+-----------------------------------------------
 I loaded the latest version of numpy and scipy but loadmat don't
 return array in numpy format. According to this tutorial it should

 http://docs.scipy.org/doc/scipy/reference/tutorial/io.html

 file was saved by MATLAB 2010 with option -v6

 I'm using win xp 32 bit and MATLAB 2010

 C:\Documents and Settings\KF\DeepLearningTutorials\code>python
 Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
 (Intel)] on
 win32
 Type "help", "copyright", "credits" or "license" for more information.
 >>> from scipy.io import loadmat, savemat

 >>> import numpy

 >>> b=loadmat('a.mat',struct_as_record = True)

 >>> b

 {'a': array([[[ 1,  4,  7, 10],
         [ 2,  5,  8, 11],
         [ 3,  6,  9, 12]]], dtype=uint8), '__version__': '1.0',
 '__header__': 'M
 ATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Mon Dec 13 01:37:53
 2010', '__g
 lobals__': []}

 >>> b.shape

 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 AttributeError: 'dict' object has no attribute 'shape'

 >>> b=loadmat('a.mat',struct_as_record = False)

 >>> b

 {'a': array([[[ 1,  4,  7, 10],
         [ 2,  5,  8, 11],
         [ 3,  6,  9, 12]]], dtype=uint8), '__version__': '1.0',
 '__header__': 'M
 ATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Mon Dec 13 01:37:53
 2010', '__g
 lobals__': []}

 >>> b.shape

 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 AttributeError: 'dict' object has no attribute 'shape'

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1348>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list