[Eeglablist] Passing vector elements to pop_select() 'no channel' argument

chao wang hnchaowang at gmail.com
Wed Apr 5 20:36:20 PDT 2017


Hi Laura,

Just a guess. You want to replace some bad channel by interpolating it. If
this is true, I think it's not correct to remove them prior to
interpolation, or you'll interpolate another channel instead, and if the
channel to remove is the last channel, it would encounter dimension errors
similar to the one you showed. So, you may need to remove 'pop_select'
command from your code.

Best,
Chao

Chao Wang, PhD Candidate
Institute of Biomedical Engineering
Xi'an Jiaotong University
No.28, Xianning West Road, Xi'an, P.R. China

On Thu, Apr 6, 2017 at 11:07 AM, Morett, Laura <laura.morett at yale.edu>
wrote:

> Hi Chao,
>
> Thanks for your helpful reply.  I tried both configurations, and the first
> one (numeric) appears to allow this portion of my script to proceed.
> However, when I run it, I now receive the following error:
>
>
>
> Removing 1 channel(s)...
>
> Index exceeds matrix dimensions.
>
>
>
> Error in pop_select (line 234)
>
>          noChannelAsCell{nochanId} = EEG.chanlocs(g.nochannel(
> nochanId)).labels;
>
>
>
> Error in eeg_interp (line 139)
>
>         EEG       = pop_select(EEG, 'nochannel', badchans);
>
>
>
> Error in pop_interp (line 156)
>
>     EEG = eeg_interp(EEG, bad_elec, method);
>
>
>
> Below is the next line of the script.  Any insight anyone can provide into
> what’s causing this new error would be greatly appreciated.
>
>
>
>  EEG = pop_interp(EEG, chan_remove{s}, 'spherical');
>
>
>
> Thanks,
>
> Laura
>
>
>
>
>
> ********************************************************
>
> Laura M. Morett
>
> Hilibrand Postdoctoral Fellow
>
> Yale Child Study Center
>
> 230 S. Frontage Rd.
>
> New Haven, CT 06520
>
>
>
> As of August 16, 2017:
>
> Assistant Professor of Educational Psychology
>
> Educational Neuroscience Initiative
>
> University of Alabama
>
> Box 870231
>
> Tuscaloosa, AL 35487-0231
>
>
>
> Email: laura.morett at yale.edu
>
> Phone: (203) 737-4586
>
> Web: http://lauramorett.strikingly.com/
> <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=>
>
>
>
> *From: *chao wang <hnchaowang at gmail.com>
> *Date: *Wednesday, April 5, 2017 at 9:14 PM
> *To: *EEGLAB List <eeglablist at sccn.ucsd.edu>
> *Cc: *"Morett, Laura" <laura.morett at yale.edu>
> *Subject: *Re: Passing vector elements to pop_select() 'no channel'
> argument
>
>
>
> Hi, Laura
>
>
>
> 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:
>
>
>
> chan_remove = {128, [87, 119], 104, 104, 119, 15}; % (each cell is a
> vector of channel indices)
>
>
>
> OR
>
>
>
> chan_remove2 = {'E128', {'E87','E119'}, 'E104', 'E104', 'E119', 'E15'}; %
> (each cell is a cell array of channel indices)
>
>
>
> You can try them.
>
>
>
> Best,
>
> Chao
>
>
>
>
>
> On Thu, Apr 6, 2017 at 3:00 AM, <eeglablist-request at sccn.ucsd.edu> wrote:
>
>
> ---------- Forwarded message ----------
> From: "Morett, Laura" <laura.morett at yale.edu>
> To: "eeglablist at sccn.ucsd.edu" <eeglablist at sccn.ucsd.edu>
> Cc:
> Bcc:
> Date: Wed, 5 Apr 2017 13:19:01 +0000
> Subject: [Eeglablist] Passing vector elements to pop_select() 'no channel'
> argument
>
> Dear list,
>
> 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:
>
>
>
> chan_remove = {{'E128'}, [{{'E87'} {'E119'}}], {'E104'}, {'E104'},
> {'E119'}, {'E15'}}
>
> subjs_rm_chan = {'11113','11115','11135','11138','11145','11146'};
>
>
>
> nsubjbadch = length(subjs_rm_chan); % number of subjects w/ bad channels
>
>
>
> Further down, I attempt to remove them using the following code:
>
>
>
> for s=1:nsubjbadch % Loop through list of subjects with bad channels
>
>         data_path  = [home_path subjs_rm_chan{s} '/'];   % Path to the
> folder containing the current subject's data
>
>         EEG = pop_loadset('filename',[subjs_rm_chan{s}
> '_reref_filt.set'], 'filepath', data_path);
>
>         disp([chan_remove{s}]);
>
>         EEG = pop_select(EEG,'nochannel', chan_remove{s});
>
>
>
> When I run this code, I receive the following errors:
>
> Error using cell/unique (line 85)
>
> Input A must be a cell array of character vectors.
>
>
>
> Error in cell/setdiff>cellsetdifflegacy (line 199)
>
>     [a,ia] = unique(a,'legacy');
>
>
>
> Error in cell/setdiff (line 133)
>
>         [varargout{1:nlhs}] = cellsetdifflegacy(varargin{1:
> 2},logical(flaginds(1)));
>
>
>
> Error in setdiff_bc (line 20)
>
>     [C,IA] = setdiff(A,B,varargin{:},'legacy');
>
>
>
> Error in eeg_interp (line 137)
>
>         goodchans = setdiff_bc(1:EEG.nbchan, badchans);
>
>
>
> Error in pop_interp (line 156)
>
>     EEG = eeg_interp(EEG, bad_elec, method);
>
>
>
> I checked, and chan_remove is indeed not a cell array of character
> vectors, so I tried using the following alternative:
>
>
>
> chan_remove = {[128], [[87], [119]], [104], [104], [119], [15]};
>
>
>
> However, this doesn’t solve the problem, returning the following error
> when I run the code above:
>
>
>
> Index exceeds matrix dimensions.
>
>
>
> Error in pop_select (line 234)
>
>          noChannelAsCell{nochanId} = EEG.chanlocs(g.nochannel(
> nochanId)).labels;
>
>
>
> Error in eeg_interp (line 139)
>
>         EEG       = pop_select(EEG, 'nochannel', badchans);
>
>
>
> Error in pop_interp (line 156)
>
>
>
> I’ve tried several different variations of syntax in defining chan_remove
> to no avail.  Does anyone know:
>
>
>
> 1.       How I can pass a vector of channel names to cycle through to be
> selected and removed?
>
> 2.       How I can pass multiple channel names as one element to be
> selected and removed (see second element)?
>
>
>
> Thanks in advance for any help anyone can provide.
>
>
>
> Best wishes,
>
> Laura Morett
>
>
>
>
>
> ********************************************************
>
> Laura M. Morett
>
> Hilibrand Postdoctoral Fellow
>
> Yale Child Study Center
>
> 230 S. Frontage Rd.
>
> New Haven, CT 06520
>
>
>
> As of August 16, 2017:
>
> Assistant Professor of Educational Psychology
>
> Educational Neuroscience Initiative
>
> University of Alabama
>
> Box 870231
>
> Tuscaloosa, AL 35487-0231
>
>
>
> Email: laura.morett at yale.edu
>
> Phone: (203) 737-4586
>
> Web: http://lauramorett.strikingly.com/
> <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=>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20170406/ba53e0a2/attachment-0001.html>


More information about the eeglablist mailing list