[FieldTrip] ?==?utf-8?q? redefining data set

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Tue Jan 15 17:43:14 CET 2019


If I may chime in: are you by any chance looking for data.trialinfo(:,x) = [event.value]’ ?

Best JM


On 15 Jan 2019, at 17:40, Stephen Whitmarsh <stephen.whitmarsh at gmail.com<mailto:stephen.whitmarsh at gmail.com>> wrote:

Hi Martin,

No indeed, your conditions/RT/events should indeed be (re)coded as single values. This also makes selecting trials etc. much easier with logical expressions, e.g. you can then simply do cfg.trials = (data.trialinfo(:,1) == 3 && data.trialinfo(:,2) > 0.5, where the first column e.g. is your condition, and the second RT, to just give an example.

Cheers,
Stephen

On Tue, 15 Jan 2019 at 17:35, Martin Rosenfelder <martin.rosenfelder at uni-ulm.de<mailto:martin.rosenfelder at uni-ulm.de>> wrote:
Dear Stephen,

Thank you very much for the hint on ft_selectdata.

I tried to build the structure for .trialinfo as you described it in your reply. I did this creating a structure array with the eventvalues as elements.
Then I concatenated the .trl matrix and the event value matrix. This however failed, since .trl is a double array and the event value matrix is a struct array.
I double-checked that the nr. of rows in the two matrices match each other (120 elements).

Is there a way to add the event value matrix (120x1 struct) to the .trl matrix (120x3 double)?

Best,
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<mailto:martin.rosenfelder at uni-ulm.de>

Am Montag, 14. Januar 2019 19:01 CET, Stephen Whitmarsh <stephen.whitmarsh at gmail.com<mailto:stephen.whitmarsh at gmail.com>> schrieb:

> 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<mailto: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<mailto: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
> >




_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
_______________________________________________
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/20190115/7b1db410/attachment-0002.html>


More information about the fieldtrip mailing list