[FieldTrip] ft_channelrepair only for certain trials: repaired data only contain those certain trials

Vitória Piai v.piai.research at gmail.com
Fri Mar 13 16:35:05 CET 2015

Thanks, Eelke!

I had already done what you suggested. The issue is that ft_appenddata 
appends (;-) ) the data rather than restoring it back to normal. Since I 
defined all trials to repair at the very beginning, none of the indexes 
for those trials make sense anymore after the first call to 
ft_appenddata. I guess I'll work around it by keeping values rather than 
indices for the trials I need to repair.

Thanks a lot,
Hope all is well in Nijmegen!!

On 3/11/2015 12:32 AM, Eelke Spaak wrote:
> Hi Vitoria,
> Yes, that is the expected behaviour of ft_channelrepair, because that
> is consistent with all other functions supporting a cfg.trials-option
> (i.e. select first, then do the work on what remains).
> It should be quite straightforward to do something like:
> cfg = [];
> cfg.trials = goodtrials;
> dat1 = ft_selectdata(cfg, data);
> cfg = [];
> ...
> cfg.trials = badtrials;
> dat2 = ft_channelrepair(cfg, data);
> datcmb = ft_appenddata([], dat1, dat2);
> to achieve what you want.
> Groetjes,
> Eelke
> On 10 March 2015 at 23:58, Vitoria Piai <v.piai.research at gmail.com> wrote:
>> Hi all,
>> I'm using ft_channelrepair, ($Id: ft_channelrepair.m 9520 2014-05-14
>> 09:33:28Z) to repair bad channels. I wanted to do it only for certain
>> trials, and when I saw the option cfg.trials, I was really happy.
>> However, if I pass cfg.trials with a vector rather than 'all', then the
>> function does:
>> ft_selectdata (lines 104, 108),
>> then from line 352 onwards, things are converted back to normal.
>> But if the cfg contained only some trials (as I'm trying to use it for),
>> these are not restored back, and so I'm left with a data structure that
>> only has as many trials as my cfg had.
>> I was just wondering whether that is the expected behaviour of
>> ft_channelrepair and that I should restore things myself (presumably
>> with ft_append-like functions). If so, it would be nice if the help on
>> this function would say that...
>> If I'm simply using a too old version, my apologies. (I should start
>> working with github, I know!!)
>> Thanks a lot,
>> Vitoria
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

More information about the fieldtrip mailing list