matlabeuropean-data-format

Cutting edf file and save it in edf format using matlab


I have an edf file that contains data with 3000++ samples.

What I need is using only the first half of the data (1500++ samples).

How to cut the edf file and save it into an edf file again?


Solution

  • Take a look at this File Exchange submission: Reading and saving of data in the EDF+

    You can read the file, cut the data and save it again:

    % Read the file    
    [data, header] = readEDF(filename);
    
    % Keep only the first half (data is in a cell array)
    data = cellfun(@(x) (1:round(numel(x)/2)), data, 'UniformOutput', false);
    
    % Update this header field
    header.records = round(header.records/2);
    
    % Save the file
    SaveEDF(filename, data, header);