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.