How NOT to overwrite the .mat file when using scip

2019-07-17 02:05发布

问题:

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