How to do eeg preprocessing
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all ,
i am trying to implement a code for the sake of preprocessig an eeg signals, however i coudnt understand without comments added
Could anyone explain a bit if should add any toolbox and if i should create any folder . please add comments if possible
dataFolder='D:\Data\BCICIV_1\';
files=dir([dataFolder 'BCICIV_ca*.mat']);
ref=[];
for s=1:length(files)
s
load([dataFolder files(s).name]); fs=nfo.fs;
EEG=.1*double(cnt);
b=fir1(50,2*[8 30]/nfo.fs);%FIRfiltDesign(nfo.fs,8,30,[],[],1)
EEG=filter(b,1,EEG);
y=mrk.y'; %(-1 for class one or 1 for class two)
nTrials=length(y);
X=nan(size(EEG,2),300,nTrials);
for i=1:nTrials
X(:,:,i)=EEG(mrk.pos(i)+0.5*nfo.fs:mrk.pos(i)+3.5*nfo.fs-1,:)'; % [0.5-3.5] seconds epoch, channels*Times
end
save(['./Data1/A' num2str(s) '.mat'],'X','y','fs');
end
thans all in advance
1 commentaire
Abdullah Abdullah
le 18 Fév 2023
Replace the line X=nan(size(EEG,2),300,nTrials); by X=nan(size(EEG,2),3000,nTrials);
3000 not 300.
Réponses (1)
Jonas
le 23 Nov 2020
You should use breakpoints to step by step understand the code. Seems to use fairly basic MATLAB commands.
Regarding toolboxes, if you want to run this code, you will need the Signal Processing Toolbox to be able to use the 'fir1' function. This function is used to create a bandpass filter with a window passband as input parameter.
0 commentaires
Voir également
Catégories
En savoir plus sur EEG/MEG/ECoG dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!