使用 scipy.io.savemat() 时如何不覆盖 .mat 文件? [英] How NOT to overwrite the .mat file when using scipy.io.savemat()?

查看:76
本文介绍了使用 scipy.io.savemat() 时如何不覆盖 .mat 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 Python 的 scipy.io.savemat() 以 .mat 格式保存我的数据,这是在两者之间传输数据的有效方式:http://docs.scipy.org/doc/scipy-0.9.0/reference/tutorial/io.html.

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.

不知何故它覆盖了文件.如何设置函数以便我可以附加到 .mat 文件而不是像 MATLAB save() 的-append"选项那样覆盖?或者除了 scipy.io.savemat() 之外还有什么方法可以解决吗?

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()?

推荐答案

似乎没有办法附加 scipy.io.savemat().

您可以scipy.io.loadmat(),将您的新值附加到返回的dict,然后再次调用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.

这里是 scipy.io.loadmat() 的文档:

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

这篇关于使用 scipy.io.savemat() 时如何不覆盖 .mat 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆