[FieldTrip] reading in and segmenting Netstation data
van Hoogmoed, Anne H - (annevanhoogmoed)
annevanhoogmoed at email.arizona.edu
Thu Aug 8 05:51:47 CEST 2013
Dear all,
I'm using Fieldtrip to analyze my Netstation data. The problem is that the segmented data (incl triggers) are shifted in Fieldtrip as compared to the Netstation analysis.
I've checked several things:
- The events are the same in Netstation and Fieldtrip
- The raw data look the same in both programs
- Fieldtrip produces the right trl based on the triggers.
The script I'm using is this:
cfg = [];
cfg.dataset = 'c007_raw';
cfg.continuous = 'yes';
data_eeg = ft_preprocessing(cfg);
hdr = ft_read_header('c007_raw');
event = ft_read_event('c007_raw');
cfg = [];
cfg.trialfun = 'trialfun_first_enc';
cfg_trials = ft_definetrial(cfg);
data_trials = ft_redefinetrial(cfg_trials, data_eeg);
The trialfun I'm using is this:
function [trl, event] = trialfun_first(cfg)
load event;
load hdr;
value = [event.value];
sample = [event.sample];
% determine the number of samples before and after the trigger
pretrig = -100; % = 200 ms
posttrig = 400; % = 800 ms
% for each trigger
trl = [];
for j = 1:length(event)
if (strcmp(event(1,j).value, '+Lrt') || strcmp(event(1,j).value, '+OOt')) || strcmp(event(1,j).value, '+SOt')
trlbegin = event(1,j).sample + pretrig;
trlend = event(1,j).sample + posttrig;
offset = pretrig;
newtrl = [trlbegin trlend offset];
trl = [trl; newtrl];
end
j = j + 1;
end
Does anyone know what I'm doing wrong here?
Thank you very much for your help!
Kind regards,
Anne
Anne van Hoogmoed
Down Syndrome Research Group
Department of Psychology, University of Arizona
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130808/b55476d8/attachment-0001.html>
More information about the fieldtrip
mailing list