<div dir="ltr">Dear mne expert,<div><br></div><div>I wanted to write a covariance matrix into a *-cov.fif file using python command 'mne.write_cov' but failed. I saved the covariance matrix into a txt file 'R2262.txt' and then read it via python to cov_matrix. The error occurred in the step of 'write_cov'. In tutorial, only file name and the matrix are needed. Everything should be correct but it said 'str' had no attribute 'save'. The detail is as follows.</div><div><br></div><div>
<p class=""><span class="">>>> cov = open('/Users/Peng/Documents/MNE/MNE_analysis/MNE_TRFs/MEG/R2262_S0807/R2262cov.txt'); cov_matrix = cov.read()</span></p>
<p class=""><span class="">>>> mne.write_cov('/Users/Peng/Documents/MNE/MNE_analysis/MNE_TRFs/MEG/R2262_S0807/R2262_trf-cp-cov.fif',cov_matrix)</span></p>
<p class=""><span class="">Traceback (most recent call last):</span></p>
<p class=""><span class=""> File "<stdin>", line 1, in <module></span></p>
<p class=""><span class=""> File "/Users/Peng/Library/Python/2.7/lib/python/site-packages/mne-0.12.dev0-py2.7.egg/mne/cov.py", line 1181, in write_cov</span></p>
<p class=""><span class=""> cov.save(fname)</span></p>
<p class=""><span class="">AttributeError: 'str' object has no attribute 'save'</span></p><p class=""><span class=""><br></span></p><p class="">Do you have any idea how should this work?</p><p class="">Thank you very much!</p><p class="">Sincerely,</p><p class="">Peng</p></div></div>