[SciPy-User] Scipy.io loadmat/savemat problem

Matthew Brett matthew.brett@gmail....
Sun Jun 17 00:39:46 CDT 2012


Hi,

On Sat, Jun 16, 2012 at 6:46 AM, Peter Eckert <peter.eckert2@arcor.de> wrote:
>
> Hello Scipy-Experts,
>
> I am experiencing a problem with the scipy loadmat/savemat features.
> I have a matfile in mat-5 format which was created in Matlab that I want to manipulate. When I open the existing mat-file with loadmat and directly save the data to a new mat-file with savemat, the new file created actually differs from the original file (it seems to be less compressed). See the screenshots below.
> The new matfile can be read in Matlab without problems, however I actually want to pass the matlab to an executable created with Realtime Workshop with the rtsim option. Starting this with the new matfile creates an error "The values field in the parameters struct is invalid".
> Does anybody has experience with the difference of the savemat option compared to original Matlab matfiles and how I might change it?

I think the difference you see there is due to the lack of default
matrix compression in savemat.  You can turn it on with the
``do_compression=True`` flag to savemat.  I doubt that's the problem
though. You could also try the ``matlab_compatible`` flag to loadmat,

Best,

Matthew


More information about the SciPy-User mailing list