0001 function [arrays_meg] = meg_arrays(array_label,bad_chan); 0002 [xelec, yelec, zelec] = sensors(148); 0003 if strcmp(array_label,'left') 0004 arrays_temp = find(yelec > 0); 0005 temp = zeros(1,148); 0006 temp(arrays_temp) = ones(1,length(arrays_temp)); 0007 temp(bad_chan) = zeros(1,length(bad_chan)); 0008 arrays_meg = find(temp); 0009 elseif strcmp(array_label,'right') 0010 arrays_temp = find(yelec < 0); 0011 temp = zeros(1,148); 0012 temp(arrays_temp) = ones(1,length(arrays_temp)); 0013 temp(bad_chan) = zeros(1,length(bad_chan)); 0014 arrays_meg = find(temp); 0015 elseif strcmp(array_label,'posterior') 0016 arrays_temp = find(xelec < 0); 0017 temp = zeros(1,148); 0018 temp(arrays_temp) = ones(1,length(arrays_temp)); 0019 temp(bad_chan) = zeros(1,length(bad_chan)); 0020 arrays_meg = find(temp); 0021 elseif strcmp(array_label,'anterior') 0022 arrays_temp = find(xelec >= 0); 0023 temp = zeros(1,148); 0024 temp(arrays_temp) = ones(1,length(arrays_temp)); 0025 temp(bad_chan) = zeros(1,length(bad_chan)); 0026 arrays_meg = find(temp); 0027 elseif strcmp(array_label,'left_lat') 0028 arrays_temp = [113 95 139 121 103 138 120 102 137 119 101 136 118 100 135 117 99 134 133 116 98 132 115 97 131 114 96]; 0029 temp = zeros(1,148); 0030 temp(arrays_temp) = ones(1,length(arrays_temp)); 0031 temp(bad_chan) = zeros(1,length(bad_chan)); 0032 arrays_meg = find(temp); 0033 elseif strcmp(array_label,'right_lat') 0034 arrays_temp = [140 122 104 141 123 105 142 124 106 143 125 144 126 108 145 127 109 146 128 110 147 129 111 148 130 112]; 0035 temp = zeros(1,148); 0036 temp(arrays_temp) = ones(1,length(arrays_temp)); 0037 temp(bad_chan) = zeros(1,length(bad_chan)); 0038 arrays_meg = find(temp); 0039 else 0040 error('unknown array'); 0041 end; 0042