edfwrite replaces all values in sigdata matrix with "0.48829" in every cell (matlab 2021b)

5 views (last 30 days)
Hi Matlab team,
I tried the following code in matlab 2021b and it produced a matrix with every cell containing only one value (for the most part): 0.48829.
fs = 256;
hdr = edfheader("EDF");
hdr.StartDate = '12.01.17';
hdr.StartTime = '01.45.04';
hdr.PhysicalDimensions = repmat("mV",1,38);
hdr.Patient = '...';
hdr.SignalLabels = ["C001";"C002";"C003";"C004";"C005";"C006";"C007";"C008";"C009";"C010";"C011";"C012";"C013";"C014";"C015";"C016";"C017";"C018";"C019";"C020";"C021";"C022";"C023";"C024";"C025";"C026";"C027";"C028";"C029";"C030";"C031";"C032";"C033";"C034";"C035";"C036";"C037";"C038"]';
hdr.NumDataRecords = 1;
hdr.Recording = ['SampleRate 256' 'Recording.PatientID_StudyID = 0 0' '...'];
hdr.PhysicalMin = repmat(-32000,1,38);
hdr.PhysicalMax = repmat(32000,1,38);
hdr.DigitalMin = repmat(-32768,1,38);
hdr.DigitalMax = repmat(32767,1,38);
hdr.NumSignals = 38;
hdr.DataRecordDuration = seconds(length(sigdata2)/fs);
edfw = edfwrite('Exportv2_3.edf',hdr,sigdata2);
The 'sigdata2' matrix is a 5122 X 38 DOUBLE matrix. (38 channels)
Thanks in advance for any guidance.
Joanne Hall
Joanne Hall on 16 Jan 2022
Hi Max,
I am also attaching the original data matrix that I would like to have as the edf output (instead of all cells containing the same value).

Sign in to comment.

Answers (0)


Find more on EEG/MEG/ECoG in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by