[Eeglablist] code for converting EEGLAB to fieldtrip data formats (and vice versa)
Matt Mollison
matt.mollison at gmail.com
Sat Dec 11 12:26:42 PST 2010
Wambua, something like this should convert segmented events in EEGLAB .set
files to FieldTrip structures. Not sure how to go back to EEGLAB. Hope it
helps.
Matt
% ========================================
eventVales = {'target','lure'};
% the amount of time before and after the segmented events, in seconds
prepost = [0.5 1.5];
% importing eeglab .set files
ftype = 'eeglab_set';
% initialize the data structure
data = struct;
% add each event value as a field in the data struct
for evVal = 1:length(eventValues)
% path to the eeglab .set file
infile = fullfile('path/to/files',[eventValues{evVal},'.set']);
cfg = [];
cfg.dataset = infile;
cfg.headerfile = infile;
cfg.dataformat = ftype;
cfg.headerformat = ftype;
cfg.continuous = 'no';
cfg.trialdef.prestim = prepost(1);
cfg.trialdef.poststim = prepost(2);
cfg.trialfun = 'trialfun_general';
cfg.trialdef.eventtype = 'trigger';
cfg.trialdef.eventvalue = eventValues{evVal};
cfg = ft_definetrial(cfg);
data.(eventValues{evVal}) = ft_preprocessing(cfg);
end
% ========================================
--
Univ. of Colorado at Boulder
Dept. of Psychology and Neuroscience
matthew.mollison at colorado.edu
http://psych.colorado.edu/~mollison/
On Mon, Dec 6, 2010 at 11:31 AM, Wambua Kazi <wambua.kazi at gmail.com> wrote:
> Hello,
> Does anyone have code for converting from EEGLAB EEG data structures to
> a fieldtrip structure (and vice versa) that she or he would like to share?
> thank you,
> Wambua
>
>
>
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20101211/e9029e6e/attachment.html>
More information about the eeglablist
mailing list