custom trialfun/begin sample problem

Karl Doron karl.doron at GMAIL.COM
Thu Mar 4 10:52:05 CET 2010


I'm running a modified version of your custom trialfun script. Because I
have 'triggers' on data(1,N) and 'responses' on data(2,N), I simply did this:

% search for all "trigger" and "response" events
value  = [event.value]';

sample = [event.sample]';

% determine the number of samples before and after the trigger
pretrig  = -cfg.trialdef.prestim  * hdr.Fs; %0.5
posttrig =  cfg.trialdef.poststim * hdr.Fs; %3.5

Then I'm looking for value(j)==62 followed by value(j+1)==112, followed by
response value(j+2)==1024. All this seems to work fine. However, after
running definetrial, my first trial in cfg.trl begins with a negative
number, equal to the offset of 254.xx samples. 

However, in cfg.event, the first "62" trigger begins at sample 35557, not at
sample 1. This isn't happening in any of my other trialfun scripts.

Thank you for any help!

Karl Doron
PhD Candidate
UC, Santa Barbara

The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and

More information about the fieldtrip mailing list