[FieldTrip] redefine trials using different trigger as zero point

KatrinH Heimann katrinheimann at gmail.com
Sun Sep 28 11:54:54 CEST 2014

Dear all,
I know I asked this already twice, but I did not get the right answer yet
and just cannot figure it out myself.
So, I did cut my data in quite large trials using ft_define trial and
logging it to the beginning of a slide.

cfg                     = [];

cfg.dataset             = name;

cfg.trialfun            = 'ft_trialfun_general'; % this is the default

cfg.trialdef.eventtype  = 'trigger';

cfg.trialdef.eventvalue = 'ceck'; % the value of the stimulus trigger

cfg.trialdef.prestim    = 0.216; % in seconds

cfg.trialdef.poststim   = 7.284; % in seconds (max time of check slide)

cfg                     = ft_definetrial(cfg);

% cancel out training trials

cfg.trl([1:4],:) = [];

%change timeline according to constant offset of 16 ms = 8 samples (because
recorded with 500 hz)in

%structure trial - plus delay reported by EGE = 18 ms = 9 samples


 Then I preprocessed these trials

%% preprocess data

cfg.channel    = 'all';

cfg.preproc.detrend       = 'yes';

cfg.preproc.demean = 'yes';

cfg.preproc.baselinewindow = [-0.1 0]


mov_data           = ft_preprocessing(cfg);


save (strcat(sb,'mov_data') , 'mov_data')

Now I wanna cut out smaller pieces that are centered around another trigger
- the response of the subject. I did not use this trigger at the beginning
as then defining a baselinewindow is impossible (as the response is always
happening at a different time).

I tried to just use ft_definetrial again, as I don't see a possibility to
use ft_redefine trial:

cfg = []

cfg.dataset= strcat(sb,'mov_data.mat')

cfg.trialdef.eventtype  = 'trigger';

cfg.trialdef.eventvalue = 'resp'

cfg.trialdef.prestim    = 0.75

cfg.trialdef.poststim   = 0.75

mov_data_small = ft_definetrial(cfg)

but I get the error message:

Error using ft_read_header (line 1833)

unsupported header format (matlab)

Error in ft_trialfun_general (line 71)

hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat);

Error in ft_definetrial (line 169)

    [trl, event] = feval(cfg.trialfun, cfg);

 I wonder if that is as the file produced by fieldtrip during the
preprocessing is not one that is specified for ft_read_header - but how do
I deal with this?

Thanks a lot for your help

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140928/70c06491/attachment-0001.html>

More information about the fieldtrip mailing list