[FieldTrip] mytrialfun & ft_read_event
Harsimrat Singh
singhharsimrat at gmail.com
Mon Mar 18 17:50:56 CET 2013
Hi All****
** **
I am trying to read in my data in which the first channel contains the
marker signal (spike) superimposed on the trigger channel.****
I would like to use mytrialfun before ft_definetrial. To do this I would
like to check the value of the marker channel and compare it with mean
value of the channel and record that value in the even field.****
But I guess I can’t do it as the fieldtrip doesn’t read the channel values
before ft_definetrial. Can I use data channel values in mytrialfun? If
not, is there a way around this?****
** **
Here is my trialfun****
** **
function [trl, event] = mytrialfun(cfg)****
** **
% read the header information and the events from the data****
hdr = ft_read_header(cfg.datafile);****
event = ft_read_event(cfg.datafile,'trigindx',1,'threshold',5e2,
'detectflank','up');****
** **
% search for "trigger" events according to 'trigchannel' defined outside
the function
The problem lies here
**
*value = [event(find(cfg.trialdef.trigchannel (it needs data of this
channel & not channel
name))>mean(cfg.trialdef.trigchannel)+500)]*%mkrchannel is
data.trial{1}(1,:));
** **
% creating your own trialdefinition based upon the events****
for j = 1:length(value);****
trlbegin = sample(j) + pretrig;****
trlend = sample(j) + posttrig;****
offset = pretrig;****
newtrl = [ trlbegin trlend offset];****
trl = [ trl; newtrl]; ****
end****
** **
** **
Thanks in advance****
Best regards****
Harsimrat****
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130318/1b10e363/attachment-0001.html>
More information about the fieldtrip
mailing list