edfheader
Description
Examples
Create Header Record
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: [0x0 string]
TransducerTypes: [0x0 string]
PhysicalDimensions: [0x0 string]
PhysicalMin: []
PhysicalMax: []
DigitalMin: []
DigitalMax: []
Prefilter: [0x0 string]
SignalReserved: [0x0 string]
Create Header and Write EDF File with Signal Data
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: "05-Sep-2024 18:33:24" FileSize: 4768 Version: "0" Patient: "1234567 F 05-SEP-2024 Patient_1" Recording: "Startdate 05-SEP-2024 MW_1234567 MW_Inv_01 MW_Eq_01" StartDate: "05.09.24" StartTime: "18.33.24" HeaderBytes: 768 Reserved: "" NumDataRecords: 1 DataRecordDuration: 1 sec NumSignals: 2 SignalLabels: [2x1 string] TransducerTypes: [2x1 string] PhysicalDimensions: [2x1 string] PhysicalMin: [2x1 double] PhysicalMax: [2x1 double] DigitalMin: [2x1 double] DigitalMax: [2x1 double] Prefilter: [2x1 string] NumSamples: [2x1 double] SignalReserved: [2x1 string] Annotations: [0x2 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 05-SEP-2024 MW_1234567 MW_Inv_01 MW_Eq_01"
StartDate: "05.09.24"
StartTime: "21.12.00"
Reserved: ""
NumDataRecords: 1
DataRecordDuration: 1 sec
NumSignals: 2
SignalLabels: ["sig1" "sig2"]
TransducerTypes: [0x0 string]
PhysicalDimensions: [0x0 string]
PhysicalMin: [-3200 -3200]
PhysicalMax: [3200 3200]
DigitalMin: [-32768 -32768]
DigitalMax: [32767 32767]
Prefilter: [0x0 string]
SignalReserved: [0x0 string]
Input Arguments
filetype
— File type
"EDF"
| "EDF+"
File type, specified as "EDF"
or
"EDF+"
.
Data Types: string
Output Arguments
hdr
— Header
structure
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)