Clear Filters
Clear Filters

How to extract timing information from EDF data

6 views (last 30 days)
How can I extract timing information from EDF data? Currently I am performing spectral analysis based on FFT with the below script but I wanted to know how I can modify it to extract timing information.
clc
clear all
close all
%Convert data from edf to Matlab
[header, data] = edfread('Subject11.edf');
fs = 128; % sampling rate of Emotiv EEG
%averaging to remove common noise
for i=1:14
datan(i,:)=data(i+2,:)-mean(data(3:16,:));
end
fmin = 20; % minimum passband frequency in Hz (High Gamma)
fmax = 30; % maximum passband frequency in Hz (High Gamma)
Rs = 20; % stopband attenuation in dB
Rp = 1; % passband ripples in dB
% for High gamma band
[order, Wn] = ellipord([fmin/(fs/2), fmax/(fs/2)], [(fmin-1)/(fs/2), (fmax+1)/(fs/2)], Rp, Rs);
[B,A] = ellip(order, Rp, Rs, [fmin/(fs/2), fmax/(fs/2)]);
%filtering of entire data into High Gamma band
data_hgamma = filtfilt(B,A,datan');
%segment - extract only the eeg when subject was listening to words using marker data from channel 36
%don't forget to keep the low noise and high noise data separate
val49=find(data(36,:)==49);
val50=find(data(36,:)==50);
val51=find(data(36,:)==51);
val52=find(data(36,:)==52);
for j=1:14
for i=1:96
EEG_hgamma(j,i,:)=data_hgamma(val50(i):0.5*128-1+val50(i),j);
end
end
%0 less noise, 1 more noise
noise_array = [1 0 0 0 0 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 1 0 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 1];
p=1; q=1;
for i=1:96
if(noise_array(i)==0)
EEGL_hgamma(:,p,:)= EEG_hgamma(:,i,:);
p=p+1;
else
EEGH_hgamma(:,q,:)= EEG_hgamma(:,i,:);
q=q+1;
end
end
%%%%%%%%write script for noisy EEG data removal
for j=1:14
for i=1:size(EEGH_hgamma,2)
Energy_EEGH(j,i)=var(EEGH_hgamma(j,i,:));
end
end
for j=1:14
for i=1:size(EEGL_hgamma,2)
Energy_EEGL(j,i)=var(EEGL_hgamma(j,i,:));
end
end
for j=1:14
[P(j),H(j),STATS(j,:)] = ranksum(Energy_EEGH(j,:),Energy_EEGL(j,:),'tail','right')
end
so the timing information between val50 and val 51?

Answers (0)

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!