<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I believe I have detected a bug in pop_loadbv.m, lines 197-206, where, if the number of channels selected to import is the same as the original number of channels, EEGLAB just imports all original channels, even if the specified channels do not request that.</div><div class="">In our specific example we have a 63-channel EEG montage and an Aux channel, so a total of 64 channels. We are referencing to the right mastoid (channel 32), but during import we specify to import the following channels: [1:31 31 32:63]. We do this so that we can then set the second channel ’31' to zero and re-reference the data to the average mastoids. However, in this case the channel vector length is the same (64) as the original number of channels (64), and the </div><div class="">if EEG.nbchan == hdr.commoninfos.numberofchannels</div><div class="">statement is true, so it will just import all original channels (including the Aux channel).</div><div class=""><br class=""></div><div class="">My temporary fix is to comment out lines 197-200 and line 206, so that lines 196-206 of pop_loadbv.m now read:</div><div class=""><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(178, 69, 243);"><span class="" style="color: rgb(0, 0, 0);">        </span><span class="" style="color: rgb(4, 51, 255);">case</span><span class="" style="color: rgb(0, 0, 0);"> </span>'multiplexed'</div><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(37, 153, 45);">%             if EEG.nbchan == hdr.commoninfos.numberofchannels % Read all channels</div><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(37, 153, 45);">%                 fseek(IN, (srange(1) - 1) * EEG.nbchan * bps, 'bof');</div><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(37, 153, 45);">%                 EEG.data = fread(IN, [EEG.nbchan, EEG.pnts], [binformat '=>float32']);</div><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(37, 153, 45);">%             else % Read channel subset</div><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;">                EEG.data = repmat(single(0), [EEG.nbchan, EEG.pnts]); <span class="" style="color: rgb(37, 153, 45);">% Preallocate memory</span></div><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;">                <span class="" style="color: rgb(4, 51, 255);">for</span> chan = 1:length(chans)</div><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;">                    fseek(IN, (srange(1) - 1) * hdr.commoninfos.numberofchannels * bps + (chans(chan) - 1) * bps, <span class="" style="color: rgb(178, 69, 243);">'bof'</span>);</div><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;">                    EEG.data(chan, :) = fread(IN, [1, EEG.pnts], [binformat <span class="" style="color: rgb(178, 69, 243);">'=>float32'</span>], (hdr.commoninfos.numberofchannels - 1) * bps);</div><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;">                <span class="" style="color: rgb(4, 51, 255);">end</span></div><div class="" style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(37, 153, 45);">%             end</div><div class="" style="margin: 0px; line-height: normal; font-family: Courier; min-height: 14px;"><br class=""></div></div><div class=""><br class=""></div><div class="">Please let me know if I am making a mistake here.</div><div class=""><br class=""></div><div class="">Best,</div><div class=""><br class=""></div><div class="">Tobias</div></body></html>