[FieldTrip] Where to add a trialfun?

Ana Laura Diez Martini diezmartini at gmail.com
Sat Sep 27 19:18:25 CEST 2014


Thank you Nietzsche!

I added it where you suggested and now this is the error I get:

Error using feval
Invalid function name 'trialfun_bit2dec(cfg)'.

Error in definetrial (line 105)
    trl   = feval(cfg.trialfun, cfg);

Error in process_ERP_1_fieldtrip (line 97)
    cfg = definetrial(cfg);

Something I was worried about is that I use an old version of Fieldtrip for
my scripts because I wrote them long ago and this trialfun uses the new
format (with 'ft_s',etc.). Could this affect it in any way?

Thanks again!

On Fri, Sep 26, 2014 at 11:05 PM, Lam, Nietzsche <n.lam at fcdonders.ru.nl>
wrote:

> Hi Ana Laura,
>
> In general, you need to determine which trial function (Trialfun) to use
> when using definetrial (see this tutorial:
> http://fieldtrip.fcdonders.nl/tutorial/preprocessing  under "do the trial
> definition for the fully incongruent (FIC) condition).
>
> Please try adding this: "cfg.trialfun = 'trialfun_bit2dec(cfg)". to your
> code before calling definetrial (see below).
>
>   % TRIAL DEFINITION
>     cfg=[];
>     cfg.filename = ['my/folders/', subject, '.RAW'];
>     cfg.headerfile = ['my/folders/', subject, '.RAW'];
>
>     cfg.trialdef.eventtype    = 'STATUS';
>     cfg.trialdef.eventvalue   = cgrmrk;
>     cfg.trialdef.prestim      = 0.2;
>     cfg.trialdef.poststim     = 1;
>     cfg.trialdef.eventtype=?;
>     cfg.trialfun              = 'trialfun_bit2dec(cfg)  %% trialfun
> definition
>     cfg = definetrial(cfg);
>
>
> As an addition note: based on your error message, it seemed that the
> problem was in the function trialfun_bit2dec. However, from the code you
> showed us, you haven't referenced/called this function. I was wondering if
> the code you provide corresponded to the code that created your error
> message?  I'm guessing you ran [trl] =trialfun_bit2dec(cfg) directly (i.e.
> not via definetrial). In which case, it was looking for
> cfg.trialdef.eventtype.  You can call trialfun_bit2dec as long as you have
> all the relevant information in the cfg (which is in the code you showed
> us).  Hope this helps.
>
> Best,
> Nietzsche
>
>
>
>
> ----- Original Message -----
> > From: "Ana Laura Diez Martini" <diezmartini at gmail.com>
> > To: "FieldTrip discussion list" <fieldtrip at science.ru.nl>
> > Sent: Saturday, 27 September, 2014 2:42:21 AM
> > Subject: [FieldTrip] Where to add a trialfun?
> > Hello all! I'm having a simple problem. I want to add this trialfun:
> >
> >
> http://fieldtrip.fcdonders.nl/faq/how_can_i_transform_trigger_values_from_bits_to_decimal_representation_with_a_trialfun
> >
> >
> >
> > I get this error:
> >
> >
> >
> > Reference to non-existent field 'trialdef'.
> >
> >
> > Error in trialfun_bit2dec (line 52)
> > if strcmp(event(i).type, cfg.trialdef.eventtype)
> >
> >
> > I'm quite sure it's because I'm not writing it in the correct part of
> > my script. This is my trial definition part. Where should I add it and
> > how should I write the line?
> >
> >
> >
> > % TRIAL DEFINITION
> > cfg=[];
> > cfg.filename = ['my/folders/', subject, '.RAW'];
> > cfg.headerfile = ['my/folders/', subject, '.RAW'];
> >
> >
> > cfg.trialdef.eventtype = 'STATUS';
> > cfg.trialdef.eventvalue = cgrmrk;
> > cfg.trialdef.prestim = 0.2;
> > cfg.trialdef.poststim = 1;
> > cfg.trialdef.eventtype=?;
> >
> >
> > cfg = definetrial(cfg);
> >
> >
> > trl = cfg.trl;
> > cfg=[];
> > cfg.dataset = ['my/folders/', subject, '.RAW'];
> > cfg.trl = trl;
> > cfg.reref = 'yes';
> > cfg.refchannel = ['all'];
> >
> >
> > THANKS!
> > _______________________________________________
> > fieldtrip mailing list
> > fieldtrip at donders.ru.nl
> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> --
> Nietzsche H.L. Lam, MSc
> PhD Candidate
>
> Max Planck Institute for Psycholinguistics
> Wundtlaan 1, 6525 XD Nijmegen, The Netherlands
>
> Donders Institute for Brain, Cognition and Behaviour,
> Centre for Cognitive Neuroimaging,
> Kapittelweg 29, 6525EN Nijmegen, The Netherlands
>
> n.lam at fcdonders.ru.nl
> +31-24-3668219
>
>
> neurobiologyoflanguage.com
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140927/7ef359a9/attachment-0002.html>


More information about the fieldtrip mailing list