[Eeglablist] average re-referencing while adding online ref channel back to the data

Roberto Petrosino rp3650 at nyu.edu
Thu Apr 15 00:36:29 PDT 2021


Hello,

I am trying to create a pipeline script to run for my EEG dataset. The dataset consists of 30 eeglab files exported from the EGI system, with no information of the online reference (Cz). Right now, I am having troubles with the first steps of analysis. 

In particular, I am trying to re-reference the data to the average channels and add the online reference (Cz) back to the data. There seems to be no problems when doing this through the GUI, but the issue comes up when I try to implement it in my script. Here’s my attempt:

EEG = pop_loadset(‘dataset.set’, data_path); % open dataset
EEG = pop_chanedit(EEG, ‘load’, {[path to the coordinates.sfp], ‘filetype’, ’sfp’}, … % load new chan coordinates (including online ref)
				‘changefield’, {260, ‘datachan’, 0}, ’setref’ {‘4:259’, ‘Cz’});  % add ref chan at the end and set it as ref for the actual data (the first three channels are fiducial points
EEG = pop_reref(EEG, [], ‘keepref’, ‘on’); % re-reference the data to the average and keep the reference

The code above does not seem to anything, since the number of channels is still 256 (so, it does not include Cz). Looking at the history script, the command pop_reref() actually requires the argument 'refloc’, which takes a structure object listing a number of information regarding the channel to add back to the data. Here’s what the history script says:

EEG = pop_reref( EEG, [],'refloc',struct('labels',{'Cz'},'Y',{0},'X',{6.363e-16},'Z',{10.3915},'sph_theta',{0},'sph_phi',{90},'sph_radius',{10.3915},'theta',{0},'radius',{0},'type',{''},'ref',{''},'urchan',{260},'datachan',{0}));

My question is: how can I streamline the command so that it can be applied in a loop for all my subjects? I have also tried to give struct() less arguments (e.g., only label and urchan), but it does not work). So, it really looks like it needs the entire set of info listed above, but I wouldn’t know how to search for the info for each subject in a for loop.

Can anybody help?

Thanks!
-Roberto

—————
Roberto Petrosino
Postdoctoral Associate
Psychology, Division of Science
New York University Abu Dhabi
https://urldefense.com/v3/__https://robpetrosino.github.io__;!!Mih3wA!VkCFDqevmjSDj45G2U07Gs6ongF16T4jtBUay43tEp8TSPjeMdVCT-7e0yR4H4ZItyqPIg$  <https://urldefense.com/v3/__https://robpetrosino.github.io/__;!!Mih3wA!VkCFDqevmjSDj45G2U07Gs6ongF16T4jtBUay43tEp8TSPjeMdVCT-7e0yR4H4ZaNd6KEw$ >






More information about the eeglablist mailing list