How to load a specific channel from EEG into MATLAB

20 次查看(过去 30 天)
Hi. I am just new to EEG and also MATLAB. Currently, I am having a 14 channels EEG data, however I need only signal from 2 specific channel for analysis. How can I load the only 2 channels into MATLAB using edfread? Then, I am able to convert the data into frequency domain with the following codes but it is converting all 14 channels. Therefore, what should I modify from the existing code to get only 2 channel of signal being converted?
[header,data] = edfread("data.edf");
S = data;
y=fft(S);
PS=abs(y);
N=length(S);
fs=128;
freq=(1:N)*fs/N;
plot(freq,PS)
Your help will be highly appreciated. Thanks

采纳的回答

dpb
dpb 2018-11-28
编辑:dpb 2018-11-28
Often unless data files are simply humongous, it's just simpler to read it all in and then selectively keep what you're interested in...
nKeep=[3 11]; % arbitary selection; write some user input code to set the desired channel(s)
[header,S] = edfread("data.edf");
S = S(:,nKeep); % keep only the desired channels..
...
Carry on from there as before...
  1 个评论
David Lee
David Lee 2018-11-29
Thanks for your answer. Is it meaning that if I want to select only channel (e.g: channel 7), the code will be like below: ?
nKeep = 7;
[header,S] = edfread("data.edf");
S = S(:,nKeep);

请先登录,再进行评论。

更多回答(0 个)

类别

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