How NOT to overwrite the .mat file when using scipy.io.savemat()?

此生再无相见时 提交于 2019-12-24 03:34:33

问题


I have been using Python's scipy.io.savemat() to save my data in .mat format, efficient way to transfer data between the two: http://docs.scipy.org/doc/scipy-0.9.0/reference/tutorial/io.html.

Somehow it overwrite the file. How to set the function so I can append to the .mat file instead of overwriting just like MATLAB save()'s '-append' option? Or is there any ways to work it out other than scipy.io.savemat()?


回答1:


There doesn't appear to be a way to append with scipy.io.savemat().

You can scipy.io.loadmat(), append your new values to the dict that is returned, and then call scipy.io.savemat() again.

Here is the documentation for scipy.io.loadmat():

http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.io.loadmat.html



来源:https://stackoverflow.com/questions/26963446/how-not-to-overwrite-the-mat-file-when-using-scipy-io-savemat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!