Multiple EEG-files to one spectrogram
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi,
I am trying to plot multiple EEG-files in the SAME spectrogram in extension of eachother.
The files contain data from only one channel recording. The files are containing EEG from 6 hours in total, but they are seperated and are containing 3 hours each.
Now I want to plot them in extension of eachother in the same plot (spectrogram),
- Is this possible?
Thanks.
댓글 수: 2
답변 (1개)
Bjorn Gustavsson
2019년 3월 27일
편집: Bjorn Gustavsson
2019년 3월 27일
If there is time-gaps in your data-sequence, just do the individual spectrograms as per usual, I'd use something like this:
data_files = dir('*.dataformatofyours');
WINDOW = 256; % Or Hamming/Bartlet/Kaiser/Whatever you use
NOVERLAP = 64; % ...
Fs = 25; %
for i_t = 1:numel(data_files),
[t{i_t},EEG{i_t}] = EEG_data_reader(data_files(i_t).name);
[S{i_t},F{i_t},T{i_t}] = spectrogram(EEG{i_t},WINDOW,NOVERLAP,[],Fs);
pcolor(T{i_t}+t{i_t}(1),F{i_t},log10(abs(S{i_t}))),shading flat
hold on
end
That should concatenate the plots, with some gaps where you have data-gaps. If you concatenate the data you will no longer have constant sampling-rate - which is what the spectrogram-function implicitly use, so if you concatenate data you will get "peculiar" features in your spectrogram across the seams.
HTH
댓글 수: 3
Bjorn Gustavsson
2019년 3월 27일
1, Well, how could I possibly know what data-format you have, and what your IO-function reading the, from my vantage-point unknown data-format? I simply assumed that you had a reading-function that gave you the EEG-data channel and the corresponding time-array.
2, Yes, I edited my reply.
3, the pcolor-call is intended to plot the log10 of the spectrogram amplitude as a function of time and frequency. The different data-chunks should shifted to the start-time of the corresponding data-chunk - here I've guessed that the time you get from your EEG-reading function gives you someting like a clock-time or serial time that you can use straight off. You might have to convert the time you get to something that's continuous in time, for example if you get data in [YYYY MM DD HH MM SS] format you might convert that into running days:
t_seq{i_t} = t{i_t}(:,3) + (t{i_t}(:,4) + t{i_t}(:,5)/60 + t{i_t}(:,6)/3600)/24;
Or whatever is suitable for your data.
HTH
참고 항목
카테고리
Help Center 및 File Exchange에서 EEG/MEG/ECoG에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!