55. EEG topology preparation and use - fahsuanlin/labmanual GitHub Wiki
Data were tested on July 21 2025 in eeg_memory project.
A comprehensive excel file at Biosemi.com provided the locations of EEG sensors. This file is copied here.
Here we took the vertices and faces from a previously prepared matlab file (topology_31ch_default.mat) for the convenience sake. At the same time, prepare a file ( chan64.xlsx here) storing columns of EEG electrode names (column 1) and (x, y, z) coordinates (columns 5, 6, and 7).
NOTE: The chan64.xlsx file was edited from the Cap_coords_all.xls file.
close all; clear all;
load topology_31ch_default.mat;
etc_render_topo('vol_vertex',vertex,'vol_face',face-1)
T=readtable('chan64.xlsx');
tmp.coords=T{:,5:7}./1e3; %coordinates in meters
tmp.name=T{:,1}; %name
view(90,0);

press button b: open sensor GUI

press button l: load tmp variable. It includes fields of coords (n x 3 double). and name (n x 1 string cells).



press button k': adjust sensor positions.

press button s': snap all sensors to the closest vertices of the head mesh.

press button Save': save all adjusted electrodes.
You can also use buttons to add/delete/rename individual electrodes.
The topology file in Matlab for 32-channel MRI-compatible EEG cap.
The topology file in Matlab for 64-channel MRI-compatible EEG cap.
close all; clear all;
load pt-009_eeg1_0006_resting.mat
etc_trace(EEG,'fs',sfreq);

At the control GUI, push l and then channel label button in the Load data window. Choose the variable that stores names of electrodes. Here it is label variable.


Now the trace window should update the electrode names.

Press t to load the electrode topology definition. Here the data were from a 64-channel system (63-channel EEG + 1-channel ECG). The topology matlab file should be topology_63ch_default.mat. A topology window should appear.

Click the trace to somewhere with stronger signals. A colored topology should be shown. You can also adjust the threshold by pressing d in the topology window.

