<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:Calibri;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Calibri;
color:windowtext;}
span.msoIns
{mso-style-type:export-only;
mso-style-name:"";
text-decoration:underline;
color:teal;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:Calibri;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Dear list,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">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:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">chan_remove = {{'E128'}, [{{'E87'} {'E119'}}], {'E104'}, {'E104'}, {'E119'}, {'E15'}}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">subjs_rm_chan = {'11113','11115','11135','11138','11145','11146'};<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">nsubjbadch = length(subjs_rm_chan); % number of subjects w/ bad channels<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Further down, I attempt to remove them using the following code:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">for s=1:nsubjbadch % Loop through list of subjects with bad channels<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> data_path = [home_path subjs_rm_chan{s} '/']; % Path to the folder containing the current subject's data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> EEG = pop_loadset('filename',[subjs_rm_chan{s} '_reref_filt.set'], 'filepath', data_path);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> disp([chan_remove{s}]);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> EEG = pop_select(EEG,'nochannel', chan_remove{s});<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">When I run this code, I receive the following errors:<br>
<br>
<br>
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error using cell/unique (line 85)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Input A must be a cell array of character vectors.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in cell/setdiff>cellsetdifflegacy (line 199)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> [a,ia] = unique(a,'legacy');<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in cell/setdiff (line 133)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> [varargout{1:nlhs}] = cellsetdifflegacy(varargin{1:2},logical(flaginds(1)));<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in setdiff_bc (line 20)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> [C,IA] = setdiff(A,B,varargin{:},'legacy');<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in eeg_interp (line 137)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> goodchans = setdiff_bc(1:EEG.nbchan, badchans);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in pop_interp (line 156)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> EEG = eeg_interp(EEG, bad_elec, method);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I checked, and chan_remove is indeed not a cell array of character vectors, so I tried using the following alternative:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">chan_remove = {[128], [[87], [119]], [104], [104], [119], [15]};<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">However, this doesn’t solve the problem, returning the following error when I run the code above:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Index exceeds matrix dimensions.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in pop_select (line 234)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> noChannelAsCell{nochanId} = EEG.chanlocs(g.nochannel(nochanId)).labels;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in eeg_interp (line 139)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> EEG = pop_select(EEG, 'nochannel', badchans);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in pop_interp (line 156)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I’ve tried several different variations of syntax in defining chan_remove to no avail. Does anyone know:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">1. How I can pass a vector of channel names to cycle through to be selected and removed?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">2. How I can pass multiple channel names as one element to be selected and removed (see second element)?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thanks in advance for any help anyone can provide.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Best wishes,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Laura Morett<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none">********************************************************<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">Laura M. Morett<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">Hilibrand Postdoctoral Fellow<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">Yale Child Study Center<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">230 S. Frontage Rd.<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">New Haven, CT 06520<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none">As of August 16, 2017:<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">Assistant Professor of Educational Psychology<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">Educational Neuroscience Initiative<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">University of Alabama<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">Box 870231<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">Tuscaloosa, AL 35487-0231<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none">Email: <a href="mailto:laura.morett@yale.edu"><span style="color:#0000E9">laura.morett@yale.edu</span></a><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">Phone: (203) 737-4586<o:p></o:p></p>
<p class="MsoNormal">Web: <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="><span style="color:#0000E9">http://lauramorett.strikingly.com/</span></a><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</body>
</html>