开发者

saving python variable to .mat file with scipy.io.savemat

开发者 https://www.devze.com 2022-12-17 06:19 出处:网络
Here is my python code. >>import numpy as np >>import scipy.io >>exon = [ np.array([[1, 2], [3, 4], [5, 6]]), np.array([[7, 8], [9, 10]]) ]

Here is my python code.

>>import numpy as np
>>import scipy.io
>>exon = [ np.array([[1, 2], [3, 4], [5, 6]]), np.array([[7, 8], [9, 10]]) ]
>>obj_arr = np.zeros((2,), dtype=np.object)
>>obj_arr[0] = exon[0]
>>obj_arr[1] = exon[1]
>>scipy.io.savemat('/tmp/out.mat', mdict={'exon': obj_arr}, format='5')

But I am getting an error message

Traceback (most rece开发者_如何转开发nt call last):
  File "save_mat.py", line 12, in <module>
    scipy.io.savemat('out.mat', mdict={'exon':obj_arr}, format='5')
TypeError: savemat() got an unexpected keyword argument 'format'

Many thanks for helping to figure out the problem.

Vipin T S


Looks like your scipy.io.savemat() doesn't take a 'format' keyword. Looks like it was added in SciPy 0.7, perhaps you need to upgrade?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号