[FieldTrip] redefining data set

Stephen Whitmarsh stephen.whitmarsh at gmail.com
Mon Jan 14 19:01:23 CET 2019


Dear Martin,

Use ft_selectdata instead of ft_redefinetrial.

"cfg.previous.previous.previous{1,1}.previous.previous.trialdef.eventvalue(1,2)"
is scary! And I can imagine very inconvenient, as it will move deeper and
deeper in to infinite previousnessness.
Instead, one of the best 'easter eggs' (i.e. not so well-documented
functionality) of FieldTrip is to create extra columns of info in your .trl
when using preprocessing to epoch your data. These extra columns will then
enter into a field .trialinfo of your data. Most if not all functions, such
as ft_selectdata (selecting trials) will update that field. So I advice you
to put your eventvalue (as well as RT, response, etc. etc.) as columns in
your trialinfo (so same nr. of rows as your nr. of trials). In this way,
they will travel with your data, and stay in the same structure and on the
same level whatever happens.

Cheers,
Stephen


On Mon, 14 Jan 2019 at 18:47, Martin Rosenfelder <
martin.rosenfelder at uni-ulm.de> wrote:

> Dear Fieldtrip community,
>
> I have preprocessed a single dataset with two different conditions
> ('Swim', 'Rest'). The conditions are stored in the 'eventvalue' field of
> the cfg as 1x2 cell array. The event values are stored in the
> 'data_ref.cfg.previous.previous.previous{1,1}.previous.previous.trialdef.eventvalue'
> field of the data set.
> Having done the preprocessing I now would like to do ft_timelockanalysis
> and ft_freqanalysis on the data. Afterwards I statistically compare the two
> conditions using ft_timelockstatistics and ft_freqstatistics.
> How can I split the data set according to the event values ('Swim',
> 'Rest')? I need the event values to split the data set into the two trial
> classes in the ft_timelockanalysis / ft_freqanalysis and to compare these
> two conditions.
>
> I tried ft_redefinetrial, but do not know how to define the cfg.trials
> field of this function.
>
>          % trial redefinition
>
>         % containing only trials in the 'swim' condition
>          cfg.trials = (1,
> data_ref.cfg.previous.previous.previous{1,1}.previous.previous.trialdef.eventvalue(1,1));
>          swim = ft_redefinetrial(cfg,data_ref);
>
>         % containing only trials in the 'resting' condition
>          cfg.trials = (1,
> data_ref.cfg.previous.previous.previous{1,1}.previous.previous.trialdef.eventvalue(1,2));
>          rest = ft_redefinetrial(cfg,data_ref);
>
> I hope the description was quite clear. In case, I can provide some more
> lines of code to clarify the issue.
>
> Thank you very much in advance for your advice!
>
> Best regards,
> Martin
>
> --
> M.Sc.-Psych. Martin Rosenfelder
> Wissenschaftlicher Mitarbeiter
> Klinische und Biologische Psychologie
> Universit├Ąt Ulm
> Raum 47.2.259
> +49 731-50 26592
> martin.rosenfelder at uni-ulm.de
>
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190114/17906a79/attachment-0002.html>


More information about the fieldtrip mailing list