# Save data to certain format

**URL:** <https://mne.discourse.group/t/save-data-to-certain-format/983>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [March 31, 2016, 10:13pm UTC](https://mne.discourse.group/t/save-data-to-certain-format/983 "2016-03-31T22:13:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 31, 2016, 10:13pm UTC](https://mne.discourse.group/t/save-data-to-certain-format/983/1 "2016-03-31T22:13:44Z")

</div>

Dear all,

I loaded my eeg data from \*.edf format files. After adding a duplicate  
channel, I want to save the raw data back a \*.edf format file:

raw.save('sample\_edf.edf',overwrite=True)

The file seems to be much bigger than the original one, from 460,000 KB to  
860,000 KB.

Also, when I try to import it to Matlab EEGLAB, it says:  
EEGLAB error in function getfiletype() at line 1111:

Operands to be || and && operators must be convertible to logical scalar  
values.

And then I try to open the \*.edf file in EDFbrowser, and return error:  
1th character of version field is not a valid 7-bit ASCII character. File  
is not a valid EDF or BDF file.

I try to just read the \*.edf file to python and save it to another \*.edf  
file, same errors occur.

QUESTION:  
Is there a format of file I could export my raw data so that it is readable  
in Matlab EEGLAB? Or is there a way to save the raw data to a readable  
\*.edf file?

Thank you very much for your time,

Sincerely,

Ning  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20160331/b2e6c1f0/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160331/b2e6c1f0/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 1, 2016, 3:10am UTC](https://mne.discourse.group/t/save-data-to-certain-format/983/2 "2016-04-01T03:10:33Z")

</div>

Hi Ning,

The only output file from MNE is the \*.fif. We read the multiple formats  
but we have two options for getting the data out: 1. raw.save with the  
\*.fif, or 2. externally from the numpy.ndarray as an npy with `np.save` or  
as a mat file with `scipy.io.savemat`. The latter seems like the most  
suitable if you want to interact with EEGLAB in Matlab.

HTH,

teon

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 1, 2016, 3:55pm UTC](https://mne.discourse.group/t/save-data-to-certain-format/983/3 "2016-04-01T15:55:06Z")

</div>

Thank you very much! It really helps!!

Ning

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 1, 2016, 6:26pm UTC](https://mne.discourse.group/t/save-data-to-certain-format/983/4 "2016-04-01T18:26:30Z")

</div>

Hi Teon,

I try to use savemat to save the raw data, but savemat cannot handle  
'nonetype' class. I delete all the empty fields from the raw using pop()  
because I think raw is a dictionary. However, there are still 'nonetype'  
class in raw. Do you know if there is a way to handle it?

Thank you very much for your time,

Ning

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 1, 2016, 6:29pm UTC](https://mne.discourse.group/t/save-data-to-certain-format/983/5 "2016-04-01T18:29:04Z")

</div>

Have you tried having raw.\_data only ?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 1, 2016, 6:29pm UTC](https://mne.discourse.group/t/save-data-to-certain-format/983/6 "2016-04-01T18:29:38Z")

</div>

You can also read the fiff files in using the matlab toolbox

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 1, 2016, 6:41pm UTC](https://mne.discourse.group/t/save-data-to-certain-format/983/7 "2016-04-01T18:41:17Z")

</div>

Using only raw.\_data works.

Ning

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 1, 2016, 8:04pm UTC](https://mne.discourse.group/t/save-data-to-certain-format/983/8 "2016-04-01T20:04:20Z")

</div>

adding a few lines on this to the doc would be neat.

let's make it happen

A
