edfwrite can not export my signal properly
3 次查看(过去 30 天)
显示 更早的评论
Hi Everyone,
I would like to export my signal in edf format, using MATLAB 2022a (academic use). I wrote the following code for a representative EEG:
EEG=randn(1,360000);
%% edfheader
hdr = edfheader("EDF+");
hdr.Patient = "Mouse F";
hdr.Recording = "INH50";
hdr.StartDate = "13.09.23";
hdr.StartTime = "13.09.24";
hdr.Reserved = "EDF+C";
hdr.NumSignals = 1;
hdr.NumDataRecords = 1;
hdr.PhysicalMin = [-3200];
hdr.PhysicalMax = [3200];
hdr.DigitalMin = [-32768];
hdr.DigitalMax = [32767];
hdr.DataRecordDuration = seconds(360);
%%
edfwrite("EDFTEST.edf",hdr,EEG);
But when I use edfread to opne it, it shows:
edfread("EDFTEST.edf")
ans =
timetable
Record Time Signal_1
___________ _________________
0 sec {360000×1 double}
When I open the edf file in another program (Sigview), it is unusal:
Indeed, first I tried the code with my real EEG signal, and the exported signal was just some vertical lines!
It would be great if someone could tell me what my mistake in the code is, particularly in the header. I tried different values for PhysicalMin, PhysicalMax, DigitalMin, and DigitalMax, but there was no improvement.
I really appreciate your help, as I am stuck at this step!
0 个评论
采纳的回答
Taylor
2023-11-2
You're on the right track thinking about the PhysicalMin, PhysicalMax, DigitalMin, and DigitalMax values. You need to specify the InputSampleType as "physical" when calling edfwrite.
A good indication that there is an issue involving ADC is the multi-level "clipping" you're seeing in your plot.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 AI for Signals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!