How to load a specific channel from EEG into MATLAB

19 visualizaciones (últimos 30 días)
David Lee
David Lee el 28 de Nov. de 2018
Comentada: David Lee el 29 de Nov. de 2018
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

Respuesta aceptada

dpb
dpb el 28 de Nov. de 2018
Editada: dpb el 28 de Nov. de 2018
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 comentario
David Lee
David Lee el 29 de Nov. de 2018
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);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre EEG/MEG/ECoG en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by