[FieldTrip] using ft_definetrial
Nikola Valchev
nikola.valchev.umcg at gmail.com
Tue Jul 14 14:36:00 CEST 2015
Hi Pelt,
Thanks a lot for the help. Somehow I forgot that I can specify my own trl
matrix manually...
(Im sorry for the long email but I try to be as clear as possible so that
it takes less time.)
However, there is still something wrong which I dont understand. What I do
is to use ft_read_event to read all the triggers and events from the cnt
file. What I get is the event structure with the fileds
type
sample
value
offset
duration
I presume that these are read from the trg file (i.e. s14_CI_1.trg which is
associated with the s14_CI_1.cnt).
Inside that file I have:
0.000000 0 0
20.568359 2490491 1
23.787109 2879419 9
28.597656 3460687 1
33.056641 3999475 3
45.923828 5554243 1
...
First column should be the times, second the segment and the third the
trigger. I use your commands to create the matrix:
u1=find(ismember(triggers(:,2),[1]));
trl= [triggers(u1,2)-.2*1024 triggers(u1,2)+6*1024
repmat(-.2*1024,numel(u1),1)];
And at the end I get a matrix:
1.0e+003 *
-0.2038 6.1450 -0.2048
-0.2038 6.1450 -0.2048
-0.2038 6.1450 -0.2048
-0.2038 6.1450 -0.2048
...
Then I attempt to preprocess again:
cfg=[];
cfg.dataset='C:\eeg_anita\data\S14\s14_CI_1.cnt';
cfg.headerfile='C:\eeg_anita\data\S14\s14_CI_1.cnt';
cfg.trl=trl;
cfg_test=ft_preprocessing(cfg);
and I get an error:
??? Error using ==> ft_read_data at 206
cannot read data before the begin of the file
Error in ==> ft_preprocessing at 563
dat = ft_read_data(cfg.datafile, 'header', hdr, 'begsample',
begsample, 'endsample', endsample, 'chanindx', rawindx,
'checkboundary', strcmp(cfg.continuous, 'no'), 'dataformat',
cfg.dataformat)
Nikola
From: fieldtrip-bounces at science.ru.nl
[mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Pelt, S. van (Stan)
Sent: 14 July 2015 09:25
To: FieldTrip discussion list
Subject: Re: [FieldTrip] using ft_definetrial
Hi Nikola,
You might also try a workaround:
% read the events from the data
event = ft_read_event('C:\eeg_anita\data\S14\s14_CI_1.cnt');
% search for "trigger" events
triggers=[];
for i=1:size(event,1)
a=find(strcmp(event(i).type,'trigger')==1);
if a>0
triggers=[triggers; event(i).value event(i).sample];
end
end
% make cfg.trl: I think this is where things go wrong in your script. You
could check whats in triggers(:,1). Otherwise, whats below should work:
u1=find(ismember(triggers(:,1),[1 3 6 9])); % select your eventvalue(s) of
interest
trl= [triggers(u1,2)-.2*fs triggers(u1,2)+6*fs repmat(-.2*fs,numel(u1),1)];
% 0.2 prestim, 6s post-stim, with fs being your sampling frequency
% next, do preprocessing, with cfg.trl=trl;
From: fieldtrip-bounces at science.ru.nl
[mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Jörn M. Horschig
Sent: dinsdag 14 juli 2015 8:38
To: 'FieldTrip discussion list'
Subject: Re: [FieldTrip] using ft_definetrial
Hi Nikola,
seems to be a nasty problem. Id start with using event =
ft_read_events(cfg.dataset) and then check up the event-structure on how
they are defined there. ft_trialfun_general is literally checking that
event-structure, so defining them like they are specified in there might
help.
Best,
Jörn
--
Jörn M. Horschig, PhD, Software Engineer
<http://www.artinis.com/> Artinis Medical Systems | +31 481 350 980
From: fieldtrip-bounces at science.ru.nl
[mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Nikola Valchev
Sent: Monday, July 13, 2015 9:51 PM
To: 'FieldTrip discussion list'
Subject: Re: [FieldTrip] using ft_definetrial
Nope. Thats not it. No matter if I declare it as a double or string when I
call the eventtype trigger instead of ? they are not read.
Nikola
From: <mailto:fieldtrip-bounces at science.ru.nl>
fieldtrip-bounces at science.ru.nl [ <mailto:fieldtrip-bounces at science.ru.nl>
mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Pelt, S. van (Stan)
Sent: 13 July 2015 19:30
To: FieldTrip discussion list
Subject: Re: [FieldTrip] using ft_definetrial
What about
cfg.trialdef.eventvalue = 1;
Op 13 jul. 2015, om 18:36 heeft Eelke Spaak <
<mailto:eelke.spaak at donders.ru.nl> eelke.spaak at donders.ru.nl> het volgende
geschreven:
cfg.trialdef.eventvalue = {'1'};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150714/9b2375bd/attachment-0002.html>
More information about the fieldtrip
mailing list