[Eeglablist] Question about importing brain vision recorder files, reference issues

Thomas, Robin thomasrd at miamioh.edu
Fri Nov 12 05:52:51 PST 2021

Hello all,

My collaborator has an actichamp 32 channel system that records EEG using
Brain Vision Recorder.  For … reasons …, the reference channel during
recording is set to CP2 (# 23 on their electrode map).  When I import the
data into EEGLAB, the data set has 31 channels in it (which does not
include the CP2 channel that was used as a reference).  I want to add back
the reference channel as CP2 with all 0’s in it so that I can re-reference
to the average and get data back into that location offline.  There doesn’t
seem to be a way to do that using the gui edit channel locations, or by
using the re-reference option in tools.  I have knowledge of the channel
locations in spherical coordinates (theta, phi, radius) that I could
manually input as well (the locations file from the manufacturer has to
many channels in it - it is an xml file - and if I try to read it in using
the edit locations gui, errors abound).   I am willing to edit variables
directly using the command line to achieve what I need.

For example, suppose there are 503990 time points (i.e., columns) in the
EEG.data matrix when there are only 31 channels imported.  I am thinking
that I could do this:

EEG.data(32,:) = zeros(1,503990);

EEG.nbchan = 32;

Now the EEG structure looks like this:


  struct with fields:

             setname: 'TestHPFilt'

            filename: ''

            filepath: ''

             subject: ''

               group: ''

           condition: ''

             session: []

            comments: 'Original file: test9-3-2021.eeg'

              nbchan: 32

              trials: 1

                pnts: 503990

               srate: 500

                xmin: 0

                xmax: 1.0080e+03

               times: [1×503990 double]

                data: [32×503990 single]

              icaact: []

             icawinv: []

           icasphere: []

          icaweights: []

         icachansind: []

            chanlocs: []

          urchanlocs: []

            chaninfo: [1×1 struct]

                 ref: 'common'

               event: [1×243 struct]

             urevent: [1×243 struct]

    eventdescription: {''  ''  ''  ''  ''  ''  ''  ''  ''}

               epoch: []

    epochdescription: {}

              reject: [1×1 struct]

               stats: [1×1 struct]

            specdata: []

          specicaact: []

          splinefile: ''

       icasplinefile: ''

              dipfit: []

             history: '↵EEG.etc.eeglabvers = '2021.1'; % this tracks which
version of EEGLAB is being used, you may ignore it↵EEG = pop_loadbv(‘path
name deleted for privacy’, 'test9-3-2021.vhdr', [1 503990], [1 2 3 4 5 6 7
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31]);↵
EEG.setname='Test';↵EEG = eeg_checkset( EEG );↵EEG = pop_eegfiltnew(EEG,
'locutoff',0.5,'plotfreqz',1);↵EEG.setname='TestHPFilt';↵EEG =
eeg_checkset( EEG );↵pop_eegplot( EEG, 1, 1, 1);↵EEG = eeg_checkset( EEG );↵EEG
= eeg_checkset( EEG );'

               saved: 'no'

                 etc: [1×1 struct]

                 run: []

             datfile: ''

But then,I can’t seem to use edit channel locations anymore, when I select
that function from the tools menu and accept the default (channels have
known labels), I get one channel (E1) and everything seems missing.   Is
there a good way to add the recording reference channel data (all 0’s) into
the data array and re-reference to the average to get data back into CP2
location?  I am not opposed to doing all of this ‘by hand’ as in directly
editing using a script, e.g., these fields in the EEG struct.

thank you in advance,
Robin D. Thomas, Ph.D.
Full Professor and Director
Center for Human Psychophysiology
Program in Brain and Cognitive Science
Miami University, Oxford, OH 45056

More information about the eeglablist mailing list