elec_1020select - select 10-20 locations [labels,xyz] = elec_1020select(CHAN) where CHAN input is a cell array of channel names from the International 10-20 nomenclature for EEG electrode placement. For a list of the 10-20 electrode names, see the elec_1020all_cart function, which is based on: Oostenveld, R. & Praamstra, P. (2001). The five percent electrode system for high-resolution EEG and ERP measurements. Clinical Neurophysiology, 112:713-719.
0001 function [CHAN1020,XYZ1020] = elec_1020select(CHAN) 0002 0003 % elec_1020select - select 10-20 locations 0004 % 0005 % [labels,xyz] = elec_1020select(CHAN) 0006 % 0007 % where CHAN input is a cell array of channel names from the International 0008 % 10-20 nomenclature for EEG electrode placement. For a list of the 10-20 0009 % electrode names, see the elec_1020all_cart function, which is based on: 0010 % 0011 % Oostenveld, R. & Praamstra, P. (2001). The five percent electrode system 0012 % for high-resolution EEG and ERP measurements. Clinical Neurophysiology, 0013 % 112:713-719. 0014 % 0015 0016 % $Revision: 1.5 $ $Date: 2005/03/08 23:41:38 $ 0017 0018 % Copyright (C) 2005 Darren L. Weber 0019 % 0020 % This program is free software; you can redistribute it and/or 0021 % modify it under the terms of the GNU General Public License 0022 % as published by the Free Software Foundation; either version 2 0023 % of the License, or (at your option) any later version. 0024 % 0025 % This program is distributed in the hope that it will be useful, 0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0028 % GNU General Public License for more details. 0029 % 0030 % You should have received a copy of the GNU General Public License 0031 % along with this program; if not, write to the Free Software 0032 % Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 0033 0034 % Modified: 01/2005, Darren.Weber_at_radiology.ucsf.edu 0035 % 0036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0037 0038 0039 ver = '$Revision: 1.5 $ $Date: 2005/03/08 23:41:38 $'; 0040 fprintf('\nELEC_1020SELECT [v %s]\n',ver(11:15)); 0041 0042 % get the 1020 data 0043 elec = elec_1020all_cart; 0044 elec = struct2cell(elec); 0045 labels = squeeze(elec(1,:,:))'; 0046 x = squeeze(elec(2,:,:)); x = x{1}; 0047 y = squeeze(elec(3,:,:)); y = y{1}; 0048 z = squeeze(elec(4,:,:)); z = z{1}; 0049 clear elec 0050 0051 % find all the electrode names in elec.labels that match CHAN 0052 CHAN1020 = zeros(1,length(CHAN)); 0053 XYZ1020 = zeros(length(CHAN),3); 0054 for c = 1:length(CHAN), 0055 chan = CHAN{c}; 0056 index = strmatch(lower(chan),lower(labels),'exact'); 0057 if ~isempty(index), 0058 CHAN1020(c) = index; 0059 XYZ1020(c,:) = [ x(index), y(index), z(index) ]; 0060 else 0061 msg = sprintf('No match for channel: %s\n',chan) 0062 error(msg) 0063 end 0064 end 0065 0066 CHAN1020 = labels(CHAN1020); 0067 0068 return