[FieldTrip] ft redefine trials: how to change trigger?

Max Cantor mcantor at umich.edu
Tue May 27 18:58:32 CEST 2014

Hi Katrin,

It may help to see your code, but hopefully this will help. It should be as
simple as taking your epoched data from ft_definetrial and
ft_preprocessing, then creating two configurations for your timewindows and
running ft_redefinetrial.

For example (from the fieldtrip tutorial, slightly simplified by me for
explanatory purposes):


% find the interesting segments of data

cfg                             = [];
               % empty configuration
cfg.dataset                 = 'Subject01.ds';
     % name of CTF dataset
cfg.trialdef.eventtype    = 'backpanel trigger';
cfg.trialdef.prestim       = 1;
cfg.trialdef.poststim     = 2;
cfg.trialdef.eventvalue   = 3;
          % event value of FIC
cfg                             = ft_definetrial(cfg);

% preprocess the data

cfg.channel                 = {'MEG'};
dataFIC                      = ft_preprocessing(cfg);

% define time window

cfg                            = [];

cfg.toilim                   = [-0.5 0];
dataPre                     = ft_redefinetrial(cfg, dataFIC);

cfg.toilim                   = [0.8 1.3];
dataPost                   = ft_redefinetrial(cfg, dataFIC);


So if your code resembles this, you are defining in cfg.trialdef.prestim
and cfg.trialdef.poststim a timewindow that encompasses both your baseline
period and stimulus period, then for cfg.toilim in the ft_redefinetrial
section you are setting one to your baseline period and the other to your
stimulus period, and outputting them into separate variables.

Hopefully this helps. Also, if you haven't done so already, I would
strongly recommend you run through the tutorial, as it may help answer
questions like this in the future (assuming I've properly identified the

Good luck,


On Tue, May 27, 2014 at 12:10 PM, KatrinH Heimann
<katrinheimann at gmail.com>wrote:

> Dear all,
> my name is Katrin Heimann, I am phd student at the University of Parma.
> New to Fieldtrip.
> I am doing an EEG analysis, still in the preprocessing phase.
> It is a within trials design. I would like to compare a baseline period
> with an experimental condition (visual stimulus).
>  I have a trigger after a fixation cross, then a baseline period (approx 1
> sec) , then the period of my stimulus (1 sec- starting with a bottom press
> (trigger)).
>  As I would like to apply the same baseline correction for both (the
> fixationcross period)  I planned to first define my trials as long trials
> including the timewindows of baseline and the stimulus period, applying
> filter and baselinecorrection on those long pieces. However, as I do not
> wanna do the artifact detection on the whole pieces (but seperately for
> baseline and stimulus, to avoid that I have to throw away too many trials)
> I would like to redefine my trials then, cutting out only baseline period
> and only stimulus period (starting with another trigger
> (triggervalue=resp)..
> *Unfortunately I do not understand how I can change the trigger used with
> ft redefine trial. *
> Anybody who could give me an example how that is done?
> Thanks a million
> Katrin
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

Max Cantor
Research Assistant
Computational Neurolinguistics Lab
University of Michigan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140527/82eedef3/attachment-0002.html>

More information about the fieldtrip mailing list