Effacer les filtres
Effacer les filtres

edfwrite can not export my signal properly

8 vues (au cours des 30 derniers jours)
Sadegh Rahimi
Sadegh Rahimi le 13 Sep 2023
Commenté : Sadegh Rahimi le 2 Nov 2023
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!

Réponse acceptée

Taylor
Taylor le 2 Nov 2023
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 commentaire
Sadegh Rahimi
Sadegh Rahimi le 2 Nov 2023
Thanks for your suggestion. I will implement it to see, if it would solve the issue

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur AI for Signals dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by