<div dir="ltr">Hi, Laura<div><br></div><div>In the help of the function, it says this parameter should be a "vector of channel indices to exclude from the new dataset. Can also be a cell array of channel names." So I think the following formats might be acceptable:</div><div><br></div><div>chan_remove = {128, [87, 119], 104, 104, 119, 15}; % (each cell is a vector of channel indices)</div><div><br></div><div>OR</div><div><br></div><div>chan_remove2 = {'E128', {'E87','E119'}, 'E104', 'E104', 'E119', 'E15'}; % (each cell is a cell array of channel indices)<br></div><div><br></div><div>You can try them.</div><div><br></div><div>Best,</div><div>Chao</div><div><br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 6, 2017 at 3:00 AM, <span dir="ltr"><<a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank">eeglablist-request@sccn.ucsd.edu</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>---------- Forwarded message ----------<br>From: "Morett, Laura" <<a href="mailto:laura.morett@yale.edu">laura.morett@yale.edu</a>><br>To: "<a href="mailto:eeglablist@sccn.ucsd.edu">eeglablist@sccn.ucsd.edu</a>" <<a href="mailto:eeglablist@sccn.ucsd.edu">eeglablist@sccn.ucsd.edu</a>><br>Cc: <br>Bcc: <br>Date: Wed, 5 Apr 2017 13:19:01 +0000<br>Subject: [Eeglablist] Passing vector elements to pop_select() 'no channel' argument<br>
<div bgcolor="white" lang="EN-US">
<div class="gmail-m_-4984671589596003086WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">Dear list,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">I am writing to ask how I can pass a vector with multiple channel names for removal to pop_select(). At present, I’ve defined the following vectors with the names of the channels that I want to remove (chan_remove)
and the subjects that I want to remove them from (subjs_rm_chan) near the beginning of my script:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">chan_remove = {{'E128'}, [{{'E87'} {'E119'}}], {'E104'}, {'E104'}, {'E119'}, {'E15'}}<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">subjs_rm_chan = {'11113','11115','11135','<wbr>11138','11145','11146'};<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">nsubjbadch = length(subjs_rm_chan); % number of subjects w/ bad channels<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Further down, I attempt to remove them using the following code:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">for s=1:nsubjbadch % Loop through list of subjects with bad channels<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> data_path = [home_path subjs_rm_chan{s} '/']; % Path to the folder containing the current subject's data<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> EEG = pop_loadset('filename',[subjs_<wbr>rm_chan{s} '_reref_filt.set'], 'filepath', data_path);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> disp([chan_remove{s}]);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> EEG = pop_select(EEG,'nochannel', chan_remove{s});<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">When I run this code, I receive the following errors:<br>
<br>
<br>
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Error using cell/unique (line 85)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Input A must be a cell array of character vectors.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Error in cell/setdiff>cellsetdifflegacy (line 199)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> [a,ia] = unique(a,'legacy');<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Error in cell/setdiff (line 133)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> [varargout{1:nlhs}] = cellsetdifflegacy(varargin{1:<wbr>2},logical(flaginds(1)));<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Error in setdiff_bc (line 20)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> [C,IA] = setdiff(A,B,varargin{:},'<wbr>legacy');<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Error in eeg_interp (line 137)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> goodchans = setdiff_bc(1:EEG.nbchan, badchans);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Error in pop_interp (line 156)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> EEG = eeg_interp(EEG, bad_elec, method);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">I checked, and chan_remove is indeed not a cell array of character vectors, so I tried using the following alternative:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">chan_remove = {[128], [[87], [119]], [104], [104], [119], [15]};<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">However, this doesn’t solve the problem, returning the following error when I run the code above:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Index exceeds matrix dimensions.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Error in pop_select (line 234)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> noChannelAsCell{nochanId} = EEG.chanlocs(g.nochannel(<wbr>nochanId)).labels;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Error in eeg_interp (line 139)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> EEG = pop_select(EEG, 'nochannel', badchans);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Error in pop_interp (line 156)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">I’ve tried several different variations of syntax in defining chan_remove to no avail. Does anyone know:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">1. How I can pass a vector of channel names to cycle through to be selected and removed?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">2. How I can pass multiple channel names as one element to be selected and removed (see second element)?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Thanks in advance for any help anyone can provide.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Best wishes,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Laura Morett<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal">******************************<wbr>**************************<u></u><u></u></p>
<p class="MsoNormal">Laura M. Morett<u></u><u></u></p>
<p class="MsoNormal">Hilibrand Postdoctoral Fellow<u></u><u></u></p>
<p class="MsoNormal">Yale Child Study Center<u></u><u></u></p>
<p class="MsoNormal">230 S. Frontage Rd.<u></u><u></u></p>
<p class="MsoNormal">New Haven, CT 06520<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">As of August 16, 2017:<u></u><u></u></p>
<p class="MsoNormal">Assistant Professor of Educational Psychology<u></u><u></u></p>
<p class="MsoNormal">Educational Neuroscience Initiative<u></u><u></u></p>
<p class="MsoNormal">University of Alabama<u></u><u></u></p>
<p class="MsoNormal">Box 870231<u></u><u></u></p>
<p class="MsoNormal">Tuscaloosa, AL 35487-0231<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Email: <a href="mailto:laura.morett@yale.edu" target="_blank"><span style="color:rgb(0,0,233)">laura.morett@yale.edu</span></a><u></u><u></u></p>
<p class="MsoNormal">Phone: <a href="tel:(203)%20737-4586" value="+12037374586" target="_blank">(203) 737-4586</a><u></u><u></u></p>
<p class="MsoNormal">Web: <span style="color:rgb(0,0,233)"><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lauramorett.strikingly.com_&d=CwMF-g&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=7RydtjFxlOLitiTKeuyufwjZVnuS2cr0LD3ZBHQd6QA&m=hcKHc9qk081CzOBRcCJRuXs-41-8mLMuX9gmiw_QG_g&s=UQlF7t1IaNyCaJW5l4lvUXFZvEYnMtD2_GIYvnLLIaE&e=" target="_blank">http://lauramorett.<wbr>strikingly.com/</a></span></p></div></div></blockquote></div><br></div></div></div>