[FieldTrip] mytrialfun & ft_read_event
Roemer van der Meij
r.vandermeij at donders.ru.nl
Tue Mar 19 10:47:14 CET 2013
Hi Harsimrat,
One way this could be achieved is by reading in the specific channel by
calling ft_read_data, just like calling ft_read_event and ft_read_header.
On how to specify the call to ft_read_data, please see the
documentation/help of the function.
Hope it helps,
Roemer
On Mon, Mar 18, 2013 at 5:50 PM, Harsimrat Singh
<singhharsimrat at gmail.com>wrote:
> 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****
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
--
Roemer van der Meij M.Sc.
PhD Candidate
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognition
P.O. Box 9104
6500 HE Nijmegen
The Netherlands
Tel: +31(0)24 3655932
E-mail: r.vandermeij at donders.ru.nl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130319/3571bc08/attachment-0005.html>
More information about the fieldtrip
mailing list