[SciPy-user] Re : Re : io.loadmat and mat_struct object

Nils Wagner nwagner@iam.uni-stuttgart...
Tue May 12 06:42:09 CDT 2009


On Tue, 12 May 2009 12:36:36 +0200
  Mickael <mickael.paris@gmail.com> wrote:
> 2009/5/12, Nils Wagner <nwagner@iam.uni-stuttgart.de>:
>> On Tue, 12 May 2009 11:49:15 +0200
>>   Mickael <mickael.paris@gmail.com> wrote:
>>> 2009/5/12, Nils Wagner <nwagner@iam.uni-stuttgart.de>:
>>>> Hi all,
>>>>
>>>> How can I obtain the contents of the mat_struct object ?
>>>>
>>>>>>> A['test_struct']
>>>> array([[<scipy.io.matlab.mio5.mat_struct object at
>>>> 0x2a9a0fb150>]], dtype=object)
>>>>
>>>>
>>>> Any pointer would be appreciated.
>>>>
>>>>       Nils
>>>>
>>>> _______________________________________________
>>>> SciPy-user mailing list
>>>> SciPy-user@scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>>
>>> Hi Nils,
>>>
>>> have you seen the informations inside the cookbook :
>>>
>>> http://www.scipy.org/Cookbook/Reading_mat_files
>>>
>>> Mickael.
>>
>> Hi Mickael,
>>
>> Thank you for the pointer. However the cookbook is very
>> short. How do I access arrays of structures ?
>>
> 
> I've just seen that your question is about struct in 
>mat...
> 
>> An example would be appreciated.
> 
> you can specified the format when you load a Matlab 
>structure with this option :
> 
> struct_as_record : {False, True} optional
> 
> temp =   io.loadmat('test.mat',struct_as_record:True) 
>(False is the
> default for the moment: thus structures are loaded as 
>objects. With
> True, structures are laoded as array) by the way, you 
>must be able to
> get access to yours arrays)

  
temp =   io.loadmat('test.mat',struct_as_record=True)

How can I obtain the number of arrays within a struct ?
How do I access the different arrays ?

An illustrative example would be appreciated.

Thanks in advance.

Nils


More information about the SciPy-user mailing list