Getting an evoked file in matlab

Hi MNE users,

I want to create my own evoked file using not an eeg average but a chunk
of it. I want to do this to analyze the localization of a signal that
appears at a specific time in the eeg (not related to stimuli). Therefore,
I will take a window of eeg containing this signal.

To use MNE and find the sources in the cortex, I need this "averaged" file
but I am having problems to get it.

I want to take a piece (200 ms) of raw data. I loaded the raw file in
matlab running the fiff_setup_read_raw and cut the chunk of interest using
fiff_read_raw_segment. I got a (samples x channel) file but I had problems
saving it as an averaged or evoked file. I tried using the
fiff_write_evoked command but I do not have the data.info piece nor the
tree structure.

With the raw data I got a regular averaged of some triggers and after
loading this file in matlab I replaced the data.evoked.evoked file by my
chunk of data and changed the data.info.filename for the new filename.
Doing this I was able to create the data structure of my "averaged" file
with data.info and data.evoked. When I run fiff_write_evoked it
successfully creates a file. Nevertheless, it seems this file will not be
useful since I can not load it as an evoked file in mne_browse_raw. It
prompts (Incorrect number of samples in data matrix).

I really appreciate any help!!

Thank you!

Hi Andres,

Hi MNE users,

I want to create my own evoked file using not an eeg average but a
chunk
of it. I want to do this to analyze the localization of a signal that
appears at a specific time in the eeg (not related to stimuli).
Therefore,
I will take a window of eeg containing this signal.

To use MNE and find the sources in the cortex, I need this
"averaged" file
but I am having problems to get it.

I want to take a piece (200 ms) of raw data. I loaded the raw file in
matlab running the fiff_setup_read_raw and cut the chunk of interest
using
fiff_read_raw_segment. I got a (samples x channel) file but I had
problems
saving it as an averaged or evoked file. I tried using the
fiff_write_evoked command but I do not have the data.info piece nor
the
tree structure.

With the raw data I got a regular averaged of some triggers and after
loading this file in matlab I replaced the data.evoked.evoked file
by my
chunk of data and changed the data.info.filename for the new filename.
Doing this I was able to create the data structure of my "averaged"
file
with data.info and data.evoked. When I run fiff_write_evoked it
successfully creates a file. Nevertheless, it seems this file will
not be
useful since I can not load it as an evoked file in mne_browse_raw. It
prompts (Incorrect number of samples in data matrix).

Here is what you need to do:

1. Do *not* change the filename field to the new filename. This field
should be the original filename and is used to copy additional
information from the original file to the destination file. It is
enough to define the output file name as a parameter to
fiff_write_evoked. This has no bearing to your problem, though.

2. You need to change the first and last members of the evoked data so
that last - first + 1 = size(epochs,2). This defines the time scale of
the data. If the data segment is not related to a stimulus, you may
just want to set first = 0 and last = size(epochs,2) - 1. You can also
set first and last to correspond to the sample numbers in the raw data
file.

If you just want to analyze raw data segments in mne_analyze, you can
also make your own events in mne_browse_raw, create an event file, and
read the raw data directly in mne_analyze.

I hope this helps,
Matti