[SciPy-User] scipy.io.loadmat error when trying to read a .mat file

Pauli Virtanen pav@iki...
Tue Oct 5 04:09:32 CDT 2010

Mon, 04 Oct 2010 21:41:10 -0700, Matthew Brett wrote:
> That turns out to be because the 'Summary' struct has 4 fields all named
> 'Station_Q':
> Matlab can handle that, although I don't know how you can make a
> structure that has two fields with the same name - as far as I know
> there's no way to do that with matlab syntax, e.g:
>>> a = struct('field1', 1, 'field1', 2)
> ??? Error using ==> struct
> Duplicate field name "field1"
> I don't know how to return those guys to you either - structs come back
> either as record arrays or objects, and neither allow duplicate names. 
> Of course we could rename the duplicates, but that would start to get a
> bit tangled.

Renaming to "originalname_counter" sounds like an OK solution. Skipping 
duplicates + emitting a warning might also be OK...

Pauli Virtanen

More information about the SciPy-User mailing list