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!

采纳的回答

Taylor
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.
  1 个评论
Sadegh Rahimi
Sadegh Rahimi 2023-11-2
Thanks for your suggestion. I will implement it to see, if it would solve the issue

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 AI for Signals 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by