MATLAB problem with resting-state EEG data analysis.
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Taylor
le 28 Mar 2024
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.
Réponses (1)
Aastha
le 5 Oct 2024
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!
0 commentaires
Voir également
Catégories
En savoir plus sur EEG/MEG/ECoG dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!