How to do eeg preprocessing

6 次查看(过去 30 天)
sukam
sukam 2020-11-23
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 个评论
Abdullah Abdullah
Abdullah Abdullah 2023-2-18
Replace the line X=nan(size(EEG,2),300,nTrials); by X=nan(size(EEG,2),3000,nTrials);
3000 not 300.

请先登录,再进行评论。

回答(1 个)

Jonas
Jonas 2020-11-23
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.

类别

Help CenterFile Exchange 中查找有关 EEG/MEG/ECoG 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by