<div dir="ltr">Dear Federico il Grande<div><br></div><div>Allow 'badchstr' to be a cellarray of strings like this:</div><div><br></div><div>







<p class="">badchstr = {'label2' 'labe8' ... 'label199'};<br></p><p class=""><br></p><p class="">Try this:</p><p class="">    chstr = {<span class="">'all'</span>};</p>
<p class="">    <span class="">for</span> i=1:numel(badchstr)</p><p class="">      chstr(i+1) = cellstr(sprintf(<span class="">'-%s '</span>,badchstr{i}));</p>
<p class="">    <span class="">end</span></p><p class=""><span class=""><br></span></p>
<p class="">    cfg = [];</p>
<p class="">    cfg.channel = chstr;</p>
<p class="">    dataclean = ft_preprocessing(cfg,data);</p><p class=""><br></p><p class="">Best,</p><p class="">Cristiano</p></div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 27, 2013 at 11:13 AM, Max Cantor <span dir="ltr"><<a href="mailto:mcantor@umich.edu" target="_blank">mcantor@umich.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div>Here is how I do it:</div><div>
<br></div><div>allchan = ft_read_header(dataset);</div></div><div><br></div><div>(preprocess)</div><div><br></div><div>allchan.label = [allchan.label; implicitref];</div>
</div><div><br></div><div>(after artifact rejection/ICA/etc.)</div><div><br></div>badchan  = ft_channelselection('gui', allchan.label);<br><div><br></div><div>This gives me the channel labels for all channels, with the implicitref added back in (normally this is removed), then a gui which lets me remove bad channels manually after preprocessing/artifact rejection/ICA/etc.</div>

<div><br></div><div>Hope this helps.</div><span class=""><font color="#888888"><div><br></div><div>Max Cantor</div><div>Research Assistant</div><div>Computational Neurolinguistics Lab</div><div>University of Michigan</div>
</font></span></div><div class=""><div class="h5"><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Wed, Nov 27, 2013 at 10:46 AM, "Jörn M. Horschig" <span dir="ltr"><<a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Hi Frederico,<br>
<br>
I think the best solution is to not use fieldtrip but plain matlab function. This is a small example that might help you:<br>
<br>
>> allchans = {'Fz', 'Cz', 'CPz'};<br>
>> badchans = {'Fz', 'Cz'};<br>
>> idx = ismember(allchans, badchans)<br>
<br>
idx =<br>
<br>
     1     1     0<br>
<br>
You can then use the idx variable and logical indexing to get the good channels:<br>
<br>
>> allchans(~idx)<br>
<br>
ans =<br>
<br>
    'CPz'<br>
<br>
And then use cfg.channel = allchans(~idx).<br>
<br>
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.<br>


<br>
Best,<br>
Jörn<div><div><br>
<br>
<br>
Federico Grande wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hello everyone,<br>
<br>
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.<br>


<br>
Any suggestion?<br>
<br>
Thank you very much!!<br>
<br>
All the best,<br>
<br>
Federico Grande<br>
______________________________<u></u>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/<u></u>mailman/listinfo/fieldtrip</a><br>
</blockquote>
<br>
<br></div></div>
-- <br>
Jörn M. Horschig<br>
PhD Student<br>
Donders Institute for Brain, Cognition and Behaviour<br>
Centre for Cognitive Neuroimaging<br>
Radboud University Nijmegen<br>
Neuronal Oscillations Group<br>
FieldTrip Development Team<br>
<br>
P.O. Box 9101<br>
NL-6500 HB Nijmegen<br>
The Netherlands<br>
<br>
Contact:<br>
E-Mail: <a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a><br>
Tel:    <a href="tel:%2B31-%280%2924-36-68493" value="+31243668493" target="_blank">+31-(0)24-36-68493</a><br>
Web: <a href="http://www.ru.nl/donders" target="_blank">http://www.ru.nl/donders</a><br>
<br>
Visiting address:<br>
Trigon, room 2.30<br>
Kapittelweg 29<br>
NL-6525 EN Nijmegen<br>
The Netherlands<div><div><br>
<br>
______________________________<u></u>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/<u></u>mailman/listinfo/fieldtrip</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div></div></div>