[FieldTrip] Channel_selection

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Wed Nov 27 16:46:56 CET 2013


Hi Frederico,

I think the best solution is to not use fieldtrip but plain matlab 
function. This is a small example that might help you:

 >> allchans = {'Fz', 'Cz', 'CPz'};
 >> badchans = {'Fz', 'Cz'};
 >> idx = ismember(allchans, badchans)

idx =

      1     1     0

You can then use the idx variable and logical indexing to get the good 
channels:

 >> allchans(~idx)

ans =

     'CPz'

And then use cfg.channel = allchans(~idx).

Be aware that ismember is a tricky function, because it returns the 
indices of the first vector as the first return variable and the 
respective same for the second vector as the second return variable, so 
order does matter. Just give it a try and play a bit around with it and 
you'll see.

Best,
Jörn


Federico Grande wrote:
> Hello everyone,
>
> In order to clean a little bit more my measurements, I have developed a method which detects bad channels, and now, once I have the labels of the bad channels, I want to give it to ft_preprocessing, but I don't know how. I've been looking on ft_channelselection, and it seems that there is an option , by using some like channel={'all','-channel to exclude'}. I have an array with the labels of this channels that I want to exclude, but I don't know why, it seems that I am not using it in the proper way. I have tried  with cfg.channel= {'all','-badSelections'} (badSelections is my array), and it doesn't work, since after processing, still appear all the channels in the dat.label.
>
> Any suggestion?
>
> Thank you very much!!
>
> All the best,
>
> Federico Grande
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip


-- 
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands




More information about the fieldtrip mailing list