# [Eeglablist] Average Reference after measuring 128 Ch using one of the 128 channels as reference (Cz)?

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Tue Dec 1 12:17:19 PST 2015

```Dear Ernesto,

> i have a brief question

I thought it was quite long, which is why I did not understand the question.
Let me start from here: What's the problem of importing the data and apply
average reference?

REST is a good solution but I've never been used it myself. Does REST has
Matlab code? If it's available I'd love to try it out.

Another approach is Nima Bigdely-Shamlo's PREP. It'll do conscientious
channel cleaning before average referencing.
http://journal.frontiersin.org/article/10.3389/fninf.2015.00016/abstract

Makoto

On Thu, Nov 26, 2015 at 7:14 AM, Ernesto Gonzalez Trejo <
gonzalez at snn-unit.de> wrote:

> Hi everyone,
>
> i have a brief question regarding a correct average referencing in EEGLAB,
> that until now i've been unable to solve. I've read the EEGLAB tutorial and
> also searched for some answers in the EEGLAB list but until now i didn't
> find one that helps me solve the problem.
>
>
> I am doing EEG measurements with 128 Channels, using the channel in the
> position Cz as reference(ch. 30 in my cap). During the acquisition, the
> amplifier properties have Cz set as reference for all electrodes, and  the
> Cz electrode is then measured then against the ground. Additionally, two
> more channels (63-64) are on the earlobes and are usually discarded since
> i'm not using them as reference or for data analysis.
>
>
> Given the nature of the measurement I consider the average reference the
> way to go in order to represent better the brain activity.
>
> The acquisition is done through SIMULINK and saved into a MAT file, for
> post-processing in MATLAB. (The output is a 128xL matrix, where L is the
> length of the measurement in samples).
>
>
> The problem i have is that i can't seem to indicate correctly to EEGLAB
> that the reference used in my measurement is also part of the channels.
> When i import the mat file, i cannot give explicitely the channel (as
> stated on the import window's help:
>
>
> "Ref. channel indices or mode" - [edit box] current reference. This edit
> box
> cannot be edited. To change data reference, use menu
> Tools > Re-reference calling function pop_reref(). The reference
> can be a string, 'common' indicating an unknow common reference,
> 'averef' indicating average reference, or an array of integer
> containing the indices of the reference channels."
>
>
> Then, after I import the data without a reference, I select the channel
> locations (using a self-made loc file for the cap i use). Here, each one of
> the 128 channels has a label (10-10 system names for electrodes 1-64 and
> just the electrode number for 65-128). Once loaded, i click on "Set
> Reference" and write 1:128 as channel indices and Cz as "Reference".
> (Channel 30 has the label Cz and was the reference in the measurement).
> After the locations are set, i remove channels 63 and 64, since i don't
> want to use them for AR.
>
>
> So far, so good. After this i can just go and compute the average
> reference using the tools from EEGLAB. I wanted to validate the results so
> i kept doing some tests, and i realized that if i clicked on
> tools-rereference and then to "add current reference channel back to the
> data", the error :
>
>
> "There are no Reference channel defined, add it using the channel location
> editor"
>
>
> appeared, although in the main EEGLAB window the Reference is stated to be
> Cz and Channel locations as "Yes".
>
>
> Question 1:
>
> Could it be that i am giving the Reference wrong in the channel locations?
> After reading the tutorials i only got that the reference is usually given
> as an extra channel, which is appended to the locations. In this case, it
> is not an extra channel, but channel 30 of 128. Is it wrong then, to input
> this channel as i did in the channel locations?
>
>
> Question 2:
>
> Since i wanted to see how exactly the average referencing was working, I
> checked also the reref.m function from EEGLAB and tried to run it
> standalone as follows:
>
>
> output=reref(eeg,30,'exclude',[63 64],'keepref','on');,
>
>
> where i am only interesed on the average-referenced EEG (output) and i
> give a 128xL matrix (my EEG measurement), I indicate my reference was the
> channel (row) 30, and i exclude the earlobes (63 64).
>
> The output is however very different to the one i obtain with the method
> explained above in EEGLAB.
>
> In order to obtain the (mostly) same result as in EEGLAB i have to input
> the following:
>
>
> output=reref(eeg,30,'exclude',[30 63 64],'keepref','on');
>
>
> So, what exactly am i doing wrong here? I am probably specifying the
> reference in a wrong way. How should one manage such a reference system
> within EEGLAB or in the reref function? As i understand the calculation of
> average referencing, i should NOT use the values of the reference to
> calculate the mean of all electrodes, which would be afterwards subtracted
> from each one. And if i wanted to see the signal of Cz post-AR, i would
> have it by inverting the mean of all electrodes. If so, then the right way
> to go here would be to exclude also the channel 30 in the reref function.
> Is that right?
>
>
> I am using currently EEGLAB v13.4.4b on MATLAB R2013a
>
>
>
> EG
>
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>

--
Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20151201/b2c140e7/attachment.html>
```