# mne\_raw2mat (inverse)

**URL:** <https://mne.discourse.group/t/mne-raw2mat-inverse/239>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [July 14, 2010, 4:16pm UTC](https://mne.discourse.group/t/mne-raw2mat-inverse/239 "2010-07-14T16:16:17Z")\
**Posts on this page:** 3\
**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:** [July 14, 2010, 4:16pm UTC](https://mne.discourse.group/t/mne-raw2mat-inverse/239/1 "2010-07-14T16:16:17Z")

</div>

Hi everyone,

Does anyone know if there is a way to effectively invert mne\_raw2mat? Basically, we have dumped all of our MEG channels to Matlab where we run a series of preprocessing steps, but now we want to replace the MEG channels (and just the MEG channels, we want to leave all the other channels alone) in the original raw .fif file. I tried using the read and write fif commands in Matlab for this, but ran into some errors and was wondering if there was an alternative since this seems like a simple replacing of specific data channels in a fif file (otherwise I will play around with the Matlab commands some more). Many thanks.

Avniel

---

<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:** [July 14, 2010, 4:49pm UTC](https://mne.discourse.group/t/mne-raw2mat-inverse/239/2 "2010-07-14T16:49:28Z")

</div>

I would recommend looking into the matlab function "mne\_ex\_read\_write\_raw" and trying it again in matlab. I just did something very similar to what you describe, using their script as a skeleton for mine, and it worked flawlessly. Good luck!

Elli

---

<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:** [July 15, 2010, 5:58pm UTC](https://mne.discourse.group/t/mne-raw2mat-inverse/239/3 "2010-07-15T17:58:22Z")

</div>

Hi Elli,

This is actually the first thing that came to my mind as well, however I got the following error: "Reference to non-existent field 'FIFFB\_HPI\_MEAS'." The error is in fiff\_start\_writing\_raw . I am thinking this is because my data is from a CTF machine and due to some difference in the way the data is referenced in CTF vs. Neuromag data, but have no idea how to work around this error. Anyone have any ideas of how to work around this or another way to replace the MEG channels in a raw .fif file? Many thanks!

Avniel

I would recommend looking into the matlab function "mne\_ex\_read\_write\_raw" and trying it again in matlab. I just did something very similar to what you describe, using their script as a skeleton for mine, and it worked flawlessly. Good luck!

Elli
