How to do eeg preprocessing

8 visualizzazioni (ultimi 30 giorni)
sukam
sukam il 23 Nov 2020
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 Commento
Abdullah Abdullah
Abdullah Abdullah il 18 Feb 2023
Replace the line X=nan(size(EEG,2),300,nTrials); by X=nan(size(EEG,2),3000,nTrials);
3000 not 300.

Accedi per commentare.

Risposte (1)

Jonas
Jonas il 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.

Categorie

Scopri di più su EEG/MEG/ECoG in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by