How can i plot a multiple EEG signal channels ?
Afficher commentaires plus anciens

hello sirs, how can we plot a picture has multiple EEG signal channels like the picture above. My data have sampling frequency fs= 500, recordDuration= 1s, 21 channels and 21 record numbers. Can you give me an example code ? Thanks !
Réponse acceptée
Plus de réponses (1)
Adrián László Szemenyei
le 27 Fév 2024
Modifié(e) : Adrián László Szemenyei
le 27 Fév 2024
1 vote
If you dont want to implement it, just use EEGLAB (which can read in numerous different data types, if I remember correctly, you can also use it to change your data type to .mat).
If you want to implement it with the slider and whatnot, check out MATLAB GUI and its functions (you will probably need uifigure, uipanel, uiaxes, uislider).
To change the names on the y-axis, use yticks and yticklabels function. (Note that if your data is really large and you read it all in, the GUI might be slow and/or crash, EDIT: but this is not the case for you)
Alternatively stackedplot, you can use subtightplot. Or if you dont mind if two channels possibly overlap, than add different values to the different channels.
EDIT: I realized that your data is only one second long, so you probably dont need GUI with its slider, but the rest of my answer is relevant.
3 commentaires
Adrián László Szemenyei
le 27 Fév 2024
Modifié(e) : Adrián László Szemenyei
le 27 Fév 2024
%dat= your data with size (21,500)
timemax=1;%i.e. one sec
datamax=timemax*Freq;
t=(0:datamax)./Freq;
subtight = @(m,n,p) subtightplot (m, n, p, [0.0 0.05], [0.1 0.01], [0.1 0.01]);
figure;
for k=1:size(dat,1)
subtight(size(dat,1),1,k)
plot(t(1:timemax*Freq),dat(k,1:timemax*Freq));
ylabel(['CH',num2str(k)],'FontSize',5,'FontWeight','bold','Color','b');%change this with yticks,yticklabels if you dontwant to plot
%all channels or you dont have all channels or they are in not ascending order
yticks([]);
if k~=size(dat,1) %to only have x-ticks for the last
xticks([]);
end
end
The picture looks somewhat different from what you posted since you want to plot only one second

Nguyen Ngoc Nghiem
le 27 Fév 2024
DGM
le 5 Mar 2024
Posted as comment-as-flag by Nguyen Ngoc Nghiem:
this answer was a great help for this problem
Catégories
En savoir plus sur EEG/MEG/ECoG dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
