How to load a specific channel from EEG into MATLAB

19 ビュー (過去 30 日間)
David Lee
David Lee 2018 年 11 月 28 日
コメント済み: David Lee 2018 年 11 月 29 日
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 Center および File ExchangeEEG/MEG/ECoG についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by