edfwrite can not export my signal properly
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sadegh Rahimi
il 13 Set 2023
Commentato: Sadegh Rahimi
il 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!
0 Commenti
Risposta accettata
Taylor
il 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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su AI for Signals in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!