[SciPy-User] How to handle a scipy.io.loadmat - related bug: parts of the data inaccessible after loadmat

Matthew Brett matthew.brett at gmail.com
Fri Feb 24 12:49:46 EST 2017


Hi,

On Fri, Feb 24, 2017 at 4:36 AM, Propadovic Nenad <npropadovic at gmail.com> wrote:
> Hello Matthew, hello Gregor,
>
> thank you for your answers.
>
> Yes, values struct_as_record=False and squeeze_me=True are what the
> workaround I mentioned in the initial post at:
>
> http://stackoverflow.com/questions/7008608/scipy-io-loadmat-nested-structures-i-e-dictionaries/
>
> is based on.
>
> I will use that workaround, it gives nice access to everything I need.

Sure - the other option you have is to inspect the field names of the
dtype to find the structure variable names.

> Why I hesitated initially, after finding it was that setting
> struct_as_record=False boils down to using the class
> scipy.io.matlab.mio5_params.mat_struct.
>
> When you look at the docstring of that class it says: "We deprecate this
> method of holding struct information, and will soon remove it, in favor of
> the recarray method".

Yes, sorry, I should have replied to that.  I will remove that
warning, it's become clear over time that the mini class
representation that you are using does have a place, so I don't think
we should plan to remove it:

https://github.com/scipy/scipy/pull/7090

Best,

Matthew


More information about the SciPy-User mailing list