[FieldTrip] remove trials after ft_preprocessing

Eelke Spaak eelke.spaak at donders.ru.nl
Wed Dec 14 19:15:06 CET 2011


Dear Qi Li,

There are several ways to achieve this. Both ft_selectdata and
ft_preprocessing allow you to select a subset of trials without
altering anything else in the data. Both of these functions require a
vector as input that contains the indices of the trials to be
*retained*, so you need to create this yourself. For instance:

trialsToKeep = 1:20; % initialize vector with all trial indices
trialsToKeep([1 3 5 8]) = []; % remove the trials that should go

After this you can call either:

data = ft_selectdata(data, 'rpt', trialsToKeep);

Or:

cfg = [];
cfg.trials = trialsToKeep;
data = ft_preprocessing(cfg, data);

Best,
Eelke

2011/12/14 qi li <lihqih at gmail.com>:
> I am new to fieldtrip. After I processed the data, I got
> triggered_trials =
>
>            hdr: [1x1 struct]
>          label: {273x1 cell}
>           time: {1x20 cell}
>          trial: {1x20 cell}
>        fsample: 600
>     sampleinfo: [20x2 double]
>           grad: [1x1 struct]
>            cfg: [1x1 struct]
> Now I want to remove a few trials with trial no 1 3 5 8. What command do I
> need to remove the trials and keep the structure of triggered_trials
> unchanged? Thanks!
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip




More information about the fieldtrip mailing list