MATLAB problem with resting-state EEG data analysis.

조회 수: 5 (최근 30일)
Yuqi Huang
Yuqi Huang 2024년 3월 23일
답변: Aastha 2024년 10월 5일
Hi, I am doing the pre-processing of the resting-state EEG data. I have finished re-referecing, filter, and ICA. I now have two epochs per participants, each epoch has 50 seconds of continuous data. There are no triggers or even markers included in these epoche (i have exluded the first few seconds around the start and end triggers). I want to first converge them into one continuous data (100s) and then segment it into non-overlapping 2-second segments in order to do time-frequency analysis. However, I could not find any function to do this. When i tried to carry out the following steps, it seems to always require event code. Chould anyone tell me how to segment my data? Thank you so much for answering my question.
  댓글 수: 1
Taylor
Taylor 2024년 3월 28일
Can you provide any sample code/data? It is very difficult to make any recommendations without knowing how your data is structured. Also if you are working with EEGLAB, I would also recommend looking at their FAQ pages/message boards.

댓글을 달려면 로그인하십시오.

답변 (1개)

Aastha
Aastha 2024년 10월 5일
Hi Yuqi Huang, 
I understand that you are looking for a method to combine your EEG signals, each lasting 50 seconds into a single signal and then segment that signal into non-overlapping segments of 2 seconds each.
Assuming you have the sampling frequency of the EEG signal, you can calculate the length of a 2-second segment as follows using the MATLAB code given below:
fs = % Hz; % Insert the actual value here
segment_duration = 2; % seconds
samples_per_segment = segment_duration * fs;
To combine the two EEG signals, which can be assumed to be column vectors of size Nx1, you can concatenate them using MATLAB code as follows:
eeg_combined_signal = [eeg_signal_1; eeg_signal_2];
Now, using the previously computed “samples_per_segment”, you can segment the combined EEG signal as shown in the MATLAB code below:
eeg_segments = {}; % Initialize cell array for segments
numSegments = floor(length(eeg_combined_signal) / samples_per_segment);
% Preallocate array for segments
segments = zeros(numSegments, samples_per_segment);
% Split the EEG signal into non-overlapping segments
for i = 1:numSegments
    startIdx = (i - 1) * samples_per_segment + 1;
    endIdx = i * samples_per_segment;
    eeg_segments(i, :) = eeg_combined_signal(startIdx:endIdx);
end
You may refer to MathWorks documentation for more information on “floor” function. Below is the link for the same:
This method will allow you to combine and segment the EEG signal into non-overlapping segments.
I hope this helps!

카테고리

Help CenterFile Exchange에서 EEG/MEG/ECoG에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by