File Exchange

image thumbnail

Reading and saving of data in the EDF+

version 1.3 (6.59 KB) by

Reading and saving of multichannel biological and physical signals in the European Data Format (EDF)

31 Downloads

Updated

View License

The European Data Format (EDF) is a simple and flexible format for exchange and storage of multichannel biological and physical signals.

The code is intended for reading and saving of data in the EDF+.

[data, header] = readEDF(filename)

SaveEDF(filename, data, header)

% filename - EDF+ file name (*.edf)

% data - Contains a signals matrix or cell conteins signals data

% header - Contains header structure

http://www.edfplus.info/

Comments and Ratings (7)

A very fast EDF reader. In my testing, faster than "blockEdfLoad.m".

"SaveEDF.m" has a bug. It throws error if any of the 'header.prefilt' is empty.
To tide over this, I added a check if 'header.prefilt' is empty:
if ~isempty(header.prefilt{n})
prefilt(n,1:length(header.prefilt{n})) = header.prefilt{n};
end

Mary

Mary (view profile)

Evy Cleeren

Hi,

I would like to use these functions to anonymize patients EEG data. After saving with these functions, the EEG data is rounded (-7.7058 becomes -8 and so on...). Does that matter for further analyses? How can I prevent this from happening?

Thanks a lot!

Victor

Victor (view profile)

THERE IS AN ERROR IN:

Rs=cumsum([1; header.duration*header.samplerate]); % строка индексов подблоков каналов Rs(k):Rs(k+1)-1

PLEASE FIX IT TO:

Rs=cumsum([1; header.samplerate]); % строка индексов подблоков каналов Rs(k):Rs(k+1)-1

Since header.samplerate is not a sampling frequency, but Nr of samples in one epoch, which can be more than 1 second.

Jakub

Jakub (view profile)

I believe there is an error in line 76 of << ReadEDF.m >>.

The file as-downloaded has the following:
Rs=cumsum([1; header.duration*header.samplerate]);

This is incorrect because << header.duration >> does not have to be an integer. The result is that an error occurs when the values of Rs are used to denote vector indices in line 84: Ch_data(Rs(k):Rs(k+1)-1, :)

The correct form of line 76 should be:
Rs=cumsum([1; header.samplerate]);

Helio

Helio (view profile)

Dear Andrey I'm very grateful to have found your routines. I've been dealing with edf+ annotations for a while and your reader works just flawless. Thanks a lot for sharing!

Mark Skopin

Please disregard my previous comment. I got it to work. The startime and startdate fields were not all in lowercase. Great functions and very useful! Thanks again!

Updates

1.3

Products Required change

1.2

Screenshot update

MATLAB Release
MATLAB 7.9 (R2009b)
Acknowledgements

Inspired: blockEdfLoad

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today