[Eeglablist] Need help converting common reference (Pz) to average reference using pop_reref()

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Thu Aug 3 13:27:08 PDT 2023


Dear Hamza,

There was a related question. Let me paste my response below.

This magnificent paper discusses the problem you mentioned
https://urldefense.com/v3/__https://www.frontiersin.org/articles/10.3389/frsip.2023.1064138/full__;!!Mih3wA!FuHtw8YonNwZiUDQ1s7bylLCvv_tHU0FsjHlXsjI4u6kc0dUhotAW-xTlSf2aTnaQgSHSJnH8_r2YitLFaLvVySY3eI$ 

It's actually more straightforward to edit the data directly using Matlab
command line. See my solution below.
https://sccn.ucsd.edu/wiki/Makoto's_useful_EEGLAB_code#How_to_re-reference_to_average_potential_including_the_initial_reference_.2808.2F03.2F2023.29
Note that after applying this process, you perform 'eeglab redraw'. If this
process deletes the result of the process, please let me know.

Makoto

On Tue, Aug 1, 2023 at 11:08 AM Hamza Imtiaz via eeglablist <
eeglablist at sccn.ucsd.edu> wrote:

> Hello,
>
> I am currently working on preprocessing EEG data, and I have encountered a
> challenge while trying to re-referencing data from common Pz reference to
> average reference. I would be grateful if you could assist me with this
> issue.
>
> Following the EEGLAB tutorial (5b), I have tried to retain the reference
> channel "Pz" using the code provided below:
>
> % Add layout information
> EEG = pop_chanedit(EEG, 'lookup', lookup_filepath, 'load',
> {channelloc_filepath, 'filetype', 'autodetect'});
> EEG = eeg_checkset(EEG);
>
> % Change reference to Pz
> [EEG.chanlocs.ref] = deal('Pz');
>
> % Append Pz
> EEG = pop_chanedit(EEG, 'append', 18, 'changefield',{19 'labels' 'Pz'},...
>     'changefield',{19 'type' 'REF'}, 'changefield',{19 'theta' '180'},
> 'changefield',{19 'radius' '.256'},...
>     'changefield',{19 'X' '-0.719'}, 'changefield',{19 'Y' '0'},
> 'changefield',{19 'Z' '.695'},...
>     'changefield',{19 'sph_theta' '-180'}, 'changefield',{19 'sph_phi'
> '44'}, 'changefield',{19 'sph_radius' '1'},...
>     'changefield',{19 'urchan' '1'});
>
> % Rereference to Pz
> EEG = pop_reref(EEG, [],'refloc',struct('labels',{'Pz'},'type',{'REF'},...
>         'theta',{180},'radius',{.256},'X',{-0.719},'Y',{0},...
>         'Z',{.695},'sph_theta',{-180},'sph_phi',{44},'sph_radius',...
>         {1},'urchan',{1},'ref',{''},'datachan',{0}));
>
>
> Unfortunately, running this code generates an error message:
> Error using pop_reref
> Missing reference channel information. Edit channels and add reference
> first.
>
> Thank you all in advance for your time and support.
>
> Best regards,
> Hamza Imtiaz
> _______________________________________________
> 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
>



More information about the eeglablist mailing list