edfheader
Description
Examples
Create a header record for an EDF+ file and specify the recording information. Display the header properties.
hdr = edfheader("EDF+"); hdr.Patient = "P42Dory F"; hdr.Recording = "AJMS Device2"; hdr.StartDate = "27.12.1993"; hdr.StartTime = "04.22.24"; hdr.Reserved = "EDF+C"; hdr.NumDataRecords = 1; hdr.DataRecordDuration = seconds(4.22)
hdr = struct with fields:
Patient: "P42Dory F"
Recording: "AJMS Device2"
StartDate: "27.12.1993"
StartTime: "04.22.24"
Reserved: "EDF+C"
NumDataRecords: 1
DataRecordDuration: 4.22 sec
NumSignals: []
SignalLabels: [0×0 string]
TransducerTypes: [0×0 string]
PhysicalDimensions: [0×0 string]
PhysicalMin: []
PhysicalMax: []
DigitalMin: []
DigitalMax: []
Prefilter: [0×0 string]
SignalReserved: [0×0 string]
Create a header record for a new EDF file.
hdr = edfheader("EDF");
Generate two random 1000-sample signals containing integers in the range [–24000, 32767] and add random noise to the second signal. Plot both signals.
sigdata = randi([-24000 32767],1000,2); sigdata(:,2) = sigdata(:,2) + 0.7*randn(1000,1); plot(sigdata)
Specify header properties based on the two digital signals you created. The digital minimum and maximum values correspond to the extreme values that can occur, so specify these values as –32768
and 32767
.
hdr.NumSignals = 2; hdr.NumDataRecords = 1; hdr.PhysicalMin = [-3200 -3200]; hdr.PhysicalMax = [3200 3200]; hdr.DigitalMin = [-32768 -32768]; hdr.DigitalMax = [32767 32767];
Write a new EDF file with the header structure and the random data. View the file properties.
edfw = edfwrite("rand.edf",hdr,sigdata); edfinfo("rand.edf")
ans = edfinfo with properties: Filename: "rand.edf" FileModDate: "12-Aug-2025 17:42:04" FileSize: 4768 Version: "0" Patient: "1234567 F 12-AUG-2025 Patient_1" Recording: "Startdate 12-AUG-2025 MW_1234567 MW_Inv_01 MW_Eq_01" StartDate: "12.08.25" StartTime: "17.42.03" HeaderBytes: 768 Reserved: "" NumDataRecords: 1 DataRecordDuration: 1 sec NumSignals: 2 SignalLabels: [2×1 string] TransducerTypes: [2×1 string] PhysicalDimensions: [2×1 string] PhysicalMin: [2×1 double] PhysicalMax: [2×1 double] DigitalMin: [2×1 double] DigitalMax: [2×1 double] Prefilter: [2×1 string] NumSamples: [2×1 double] SignalReserved: [2×1 string] Annotations: [0×2 timetable]
Specify a new patient identification record, change the recording start time to 21:12:00
, and specify a label for each signal. Display the header structure to see the modified properties.
hdr.Patient = "20210410 F 27-JUL-2017"; hdr.SignalLabels = ["sig1" "sig2"]; hdr.StartTime = "21.12.00"
hdr = struct with fields:
Patient: "20210410 F 27-JUL-2017"
Recording: "Startdate 12-AUG-2025 MW_1234567 MW_Inv_01 MW_Eq_01"
StartDate: "12.08.25"
StartTime: "21.12.00"
Reserved: ""
NumDataRecords: 1
DataRecordDuration: 1 sec
NumSignals: 2
SignalLabels: ["sig1" "sig2"]
TransducerTypes: [0×0 string]
PhysicalDimensions: [0×0 string]
PhysicalMin: [-3200 -3200]
PhysicalMax: [3200 3200]
DigitalMin: [-32768 -32768]
DigitalMax: [32767 32767]
Prefilter: [0×0 string]
SignalReserved: [0×0 string]
Input Arguments
File type, specified as "EDF"
or
"EDF+"
.
Data Types: string
Output Arguments
Header record, returned as a structure with these fields:
Field | Description |
---|---|
| Patient identification details, returned as a string scalar.
Patient identification details can include Patient ID, sex or gender, birth
date in |
| Recording identification details, returned as a string scalar. Recording identification details may include its start date and time, the ID of the technician that made the recording, and the ID of the equipment that made the recording. |
| Recording start date, returned as a string scalar in
|
| Recording start time, returned as a string scalar in
|
| EDF+ interruption information, returned as
For files that are not EDF+ compliant, this property is an
empty string ( |
| Number of data records in file, returned as an integer scalar. Note If |
| Duration of each data record, returned as a duration scalar. |
| Number of signals in file, returned as an integer scalar. |
| Signal names, returned as a string vector of length Note If |
| Transducer details, returned as a string vector of length |
| Signal data units, returned as a string vector of length |
| Signal minimum physical value, returned as a numeric vector of
length |
| Signal maximum physical value, returned as a numeric vector of
length |
| Signal minimum digital value, returned as a numeric vector of
length |
| Signal maximum digital value, returned as a numeric vector of
length |
| Signal data units, returned as a string vector of length |
| Additional signal information, returned as a string vector of
length |
References
[1] Kemp, Bob, Alpo Värri, Agostinho C. Rosa, Kim D. Nielsen, and John Gade. “A Simple Format for Exchange of Digitized Polygraphic Recordings.” Electroencephalography and Clinical Neurophysiology 82, no. 5 (May 1992): 391–93. https://doi.org/10.1016/0013-4694(92)90009-7.
[2] Kemp, Bob, and Jesus Olivan. "European Data Format 'plus' (EDF+), an EDF Alike Standard Format for the Exchange of Physiological Data." Clinical Neurophysiology 114, no. 9 (2003): 1755–1761. https://doi.org/10.1016/S1388-2457(03)00123-8.
Version History
Introduced in R2021a
See Also
Apps
Objects
Functions
External Websites
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)