简体   繁体   中英

scipy.io.loadmat returns MemoryError for big matlab structures

I want to open and process some big .mat files in python. The scipy.io.loadmat function is perfect for that purpose. However, the function returns MemoryError when the .mat files are big. The problem might be due to the python version I use (Python 2.7.10 32 bits, interfaced with spyder). This problem has already been raised but I can't find any decent solution. Ideally, I would be able to open these files without changing my python. Is there a way to make the scipy.io.loadmat function load just some variables contained in the .mat file?

See the documentation here: http://docs.scipy.org/doc/scipy/reference/generated/scipy.io.loadmat.html

You can pass a list of variable names to read from the file:

scipy.io.loadmat("myfile.mat", variable_names=["myvar1", "myvar2"]) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM