<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 </head><body><p>Hi everyone, </p><p>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.</p><p><br></p><p>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.</p><p><br></p><p>Given the nature of the measurement I consider the average reference the way to go in order to represent better the brain activity. </p><p>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).</p><p><br></p><p>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:</p><p><br></p><p>"Ref. channel indices or mode" - [edit box] current reference. This edit box<br> cannot be edited. To change data reference, use menu <br> Tools > Re-reference calling function pop_reref(). The reference <br> can be a string, 'common' indicating an unknow common reference, <br> 'averef' indicating average reference, or an array of integer <br> containing the indices of the reference channels."</p><p><br></p><p>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.</p><p><br></p><p>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 :</p><p><br></p><p>"There are no Reference channel defined, add it using the channel location editor"</p><p><br></p><p>appeared, although in the main EEGLAB window the Reference is stated to be Cz and Channel locations as "Yes".</p><p><br></p><p>Question 1:</p><p>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?</p><p><br></p><p>Question 2:</p><p>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:</p><p><br></p><p>output=reref(eeg,30,'exclude',[63 64],'keepref','on');,</p><p><br></p><p>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). </p><p>The output is however very different to the one i obtain with the method explained above in EEGLAB.</p><p> In order to obtain the (mostly) same result as in EEGLAB i have to input the following:</p><p><br></p><p>output=reref(eeg,30,'exclude',[30 63 64],'keepref','on');</p><p><br></p><p>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?</p><p><br></p><p>I am using currently EEGLAB v13.4.4b on MATLAB R2013a</p><p>Thanks in advance!</p><p><br></p><p>EG</p></body></html>