mne_raw2mat

Hi,

I was wondering if there is any means of writing a FIF file from the data
structures output by the mne_raw2mat command?

Otherwise, how could I replace the recordings stored in a RAW data file
(.fif) with those stored within a Matlab variable?

Thanks for your help,

--Gabriel

Hey Gabriel,

I have had to do this in MATLAB due to a digitization error (where it was
easier for me to swap data than swap sensor information / digitization). I
basically hacked my own M-file based on the mne_ex_read_write_raw.m in the
mne MATLAB toolbox, which should have all the functions you need. I'm not
sure if there's a more principled way of doing it using the MATLAB
functions currently -- it's less trivial to implement than it seems at
first because the raw file contains much more information (sensor types,
digitization info, etc.) than just the raw data samples. But if you stick
to the example file, you should be okay (and can of course check using
mne_browse_raw).

You could also consider using mne-python, where it would be the following:

import mne
raw = mne.fiff.Raw('my_raw.fif', preload=True)
raw._data[my_channel_index] = my_new_data
raw.save('my_fixed_raw.fif')
raw.plot() # if you wanted to visualize the data after changing it

I can you send the M-file I used if you want, but it's likely less useful
than the example m-file included with MNE.

Cheers,
Eric