MATLAB problem with resting-state EEG data analysis.

8 次查看(过去 30 天)
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