[FieldTrip] How to select trials based on their timing

Hayes Brenner hayes.brenner at gmail.com
Thu Jan 28 03:57:20 CET 2016


Hello everyone! I'm fairly new to Fieldtrip, so I apologize if this
question seems trivial, but I've been stuck for a while and I would greatly
appreciate everyone's help.

I have a set of data that I'm working on to get a better sense of how to
process EEG data. I'm having trouble with this part when given these
instructions:

"let's only grab trials in which a '30' also appeared along side the '20'.
[These labels are a part of cfg.trialdef.eventtype]. This '30' event code
denotes a certain kind of trial in the experiment in which only the colored
square was presented. The '30' event code should onset at the same time or
within just a few milliseconds of the onset of the '20'. Third, let's also
only grab trials in which subjects correctly responded with a button press
to the stimulus (i.e., the colored square). To do this, you'll need to make
sure there is a '90' following the '20'. The button press (or event code
'90') should appear within 1000 ms of the onset of the '20'.

My question is: how can I designate my code so that I can have a data set
that meets the following conditions? I know I should use an 'if' or 'for'
but I'm not sure how to write it exactly. Any advice? I've included my code
as is without including the file upload. As of now, I created 3 data sets,
each one with the required markers (20, 30, and 90).

ft_defaults;
cfg = [];
cfg.trialdef.eventtype = '?';
ft_definetrial(cfg);
cfg.trialdef.eventtype = 'Stim';
cfg.trialdef.prestim = 0.2;
cfg.trialdef.poststim = .8;
cfg.trialdef.eventvalue = '20';
cfg1=ft_definetrial(cfg);
cfg.trialdef.eventvalue = '30';
cfg2=ft_definetrial(cfg);
cfg.trialdef.eventvalue = '90';
cfg3=ft_definetrial(cfg);
cfg.lpfilter='yes';
cfg.lpfreq = 30;
cfg.reref         = 'yes';
cfg.implicitref   = 'REF';
cfg.refchannel    = {'LM' 'REF'};
trialdata1 = ft_preprocessing(cfg1);
trialdata2 = ft_preprocessing(cfg2);
trialdata3 = ft_preprocessing(cfg3);

Thank you all so much!

Hayes Brenner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160127/b0726da2/attachment.html>


More information about the fieldtrip mailing list