[Eeglablist] Bug in EEG channel selection during import using pop_loadbv.m?

Tobias Overath otobias at web.de
Mon Nov 19 18:50:37 PST 2018


Hi,

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.
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 
if EEG.nbchan == hdr.commoninfos.numberofchannels
statement is true, so it will just import all original channels (including the Aux channel).

My temporary fix is to comment out lines 197-200 and line 206, so that lines 196-206 of pop_loadbv.m now read:
        case 'multiplexed'
%             if EEG.nbchan == hdr.commoninfos.numberofchannels % Read all channels
%                 fseek(IN, (srange(1) - 1) * EEG.nbchan * bps, 'bof');
%                 EEG.data = fread(IN, [EEG.nbchan, EEG.pnts], [binformat '=>float32']);
%             else % Read channel subset
                EEG.data = repmat(single(0), [EEG.nbchan, EEG.pnts]); % Preallocate memory
                for chan = 1:length(chans)
                    fseek(IN, (srange(1) - 1) * hdr.commoninfos.numberofchannels * bps + (chans(chan) - 1) * bps, 'bof');
                    EEG.data(chan, :) = fread(IN, [1, EEG.pnts], [binformat '=>float32'], (hdr.commoninfos.numberofchannels - 1) * bps);
                end
%             end


Please let me know if I am making a mistake here.

Best,

Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20181119/5dbb7421/attachment.html>


More information about the eeglablist mailing list