Question

It seems I can only load everything as uint8 type, just with the following two lines,

import scipy.io X1=scipy.io.loadmat('one.mat')

all double precision numbers get transformed. I believe the creators of scipy are aware of the fact that floating-point numbers are much more common...

So, what should I do? Thank you!

Was it helpful?

Solution

What level matfile are you trying to read? According to the docs,

v4 (Level 1.0), v6 and v7 to 7.2 matfiles are supported.

You will need an HDF5 python library to read matlab 7.3 format mat files. Because scipy does not supply one, we do not implement the HDF5 / 7.3 interface here.

For the supported levels, variables should be reloaded with the dtype with which they were saved; if you'd rather load them as matlab would, add mat_dtype=True at the end of the parameters with which you call loadmat.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top