MemReadEDF

A speedy EDF+ reader that also accommodates putting sections of the data record into memory.
26 Downloads
Updated 16 Nov 2022

View License

This function reads EDF+ files extremely quickly and with specific times and channels without putting unwanted information into memory.
MemReadEDF leverages the memmap function to map the EDF+ file on disk where it can then be indedxed and put into memory for further analysis. This also cuts down on unnecessary computational time by reading the entire file and greatly reducing the time it takes to read a file.
Please help me improve this EDF+ reader. Please feel free to contact me by email or in the reviews if there is anything that isn't working when you use this script on your particular file.
EDFhdr = MemReadEDF(EDFfile)
A single output request will only read the EDF+ header information and
return it as a struct. No signal data will be outputed in the header.
EDFhdr = MemReadEDF(EDFfile, 'annotations')
Including the optional annotations argument will read the annotations
in the EDF+ file and return them in the header structure.
[EDFhdr, EDFdata] = MemReadEDF(EDFfile)
Including the secondary output will return the signal data from the
EDF+ file. If no other inputs are provided it will return the entire
signal record associated with the EDF+ file (all times and all channels)
[EDFhdr, EDFdata] = MemReadEDF(EDFfile, 'time', [0 60], 'channels', [1:12], 'annotations')
Currently there are 3 optional parameters provided for reading
information from the EDF+ file. The 'time' and 'channels' inputs
require their values after the call as seen above. The call above will
read the first 60 seconds of the recording for channels 1 through 12.
Including the 'annotations' parameter will simply write the annotations
to the struct header (EDFhdr).
'time': you can ask for any time periode you would like in seconds. The
time will start at time 0 and go until the end of the file. If you want
everything from time 100 to the end of the file but do not
know then end of the file you can simpling run the following: [EDFhdr, EDFdata] =
MemReadEDF(EDFfile, 'time', [100, inf]).
'channels': You can order the channels in any way you would like. For
example if you wanted the 3rd channel first in the data records and
the 1st channel second you could write the following: [EDFhdr, EDFdata] =
MemReadEDF(EDFfile, 'channels', [3, 1]).
'annotations': Asking for annotations will greatly increase the amount of
time it takes to run a file depending on the length of the file, the
amount of annotations or how they are saved.
If there are any compatability issues or questions feel free to contact me.

Cite As

Darion Toutant (2024). MemReadEDF (https://www.mathworks.com/matlabcentral/fileexchange/118440-memreadedf), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.3

Updated description

1.0.2

Changed description

1.0.1

Changed Summary and Description

1.0.0