Extracting epochs from an edf file to save as .m file?
51 views (last 30 days)
Show older comments
Hey, newbie to coding and all of that. I'm trying to extract 10 random epochs that are 20 seconds each from my EEG recording (.edf file). I want to be able to save these epochs as a .m file. I'm trying to do this without having to use the EEGLAB GUI. I used edfread and it seems that the data within the edf file is a timetable with a size of 5282 x 1.
Any help on how to do this would be greatly appreciated.
7 Comments
Walter Roberson
ongeveer 6 uur ago
sampling_rate = hdr.EEGEEG1A_B(1);
No.
https://www.mathworks.com/help/signal/ref/edfread.html#mw_a83171d9-fafc-4332-ad36-8243ddcc75c6 shows an example of using edfinfo() and edfread() to compute the vector of sampling frequencies, fs . sampling_rate is 1 ./ fs
Each different signal could, in theory, have a different sampling rate.
epoch_samples = epoch_duration * sampling_rate;
That might not be an integer.
What you should be doing instead, is repeatedly using timerange to extract epochs, since there could be a different number of samples in each epoch (because the epoch_samples is not certain to be an integer.)
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!