


Opens EDF/GDF/SDF files for reading and writing.
The EDF format is specified in [1], GDF in [2].
SDF is the SIESTA convention about polygraphic recordings (see [3], pp.8-9).
SDF used the EDF format.
EDF=sdfopen(Filename,'r' [,CHAN [,Mode [,TSR]]]);
[S,EDF]=sdfread(EDF, NoR, StartPos)
CHAN defines the selected Channels or a re-referencing matrix
Mode=='SIESTA' indicates that #1 - #6 is rereferenced to (M1+M2)/2
Mode=='AFIR' indicates that Adaptive FIR filtering is used for ECG removing
Implements Adaptive FIR filtering for ECG removal in EDF/GDF-tb.
based on the Algorithm of Mikko Koivuluoma <k7320@cs.tut.fi>
A delay of EDF.AFIR.delay number of samples has to be considered.
Mode=='SIESTA+AFIR' for both
Mode=='UCAL' [default]
indicates that no calibration (re-scaling) to Physical Dim. is used.
The output are 16bit interger numbers. 'UCAL' overrides 'SIESTA'
Mode=='RAW' One column represents one EDF-block
Mode=='Notch50Hz' Implements a simple FIR-notch filter for 50Hz
Mode=='RECG' Implements ECG minimization with regression analysis
Mode=='TECG' Implements ECG minimization with template removal (Test status)
Mode=='HPF0.0Hz' Implements a high-pass filter (with the zero at z=+1, i.e. a differentiator
In this case a Notch-filter and/or sub-sampling is recommended.
Mode=='TAUx.yS' compensates time-constant of x.y seconds
Mode=='EOG[hvr]' produces HEOG, VEOG and/or REOG output (CHAN not considered)
Mode=='OVERFLOW' overflow detection
Mode=='FailingElectrodeDetector' using optimized threshold based AUC for FED & OFC
Mode=='Units_Blocks' requests the arguments in SDFREAD in Blocks [default is seconds]
TSR [optional] is the target sampling rate
Currently only downsampling from 256 and 200 to 100Hz is supported.
The details are described in the appendix of [4].
EDF.ErrNo~=0 indicates that an error occured.
For compatibility to former versions,
EDF.FILE.FID = -1 indicates that file has not been opened.
Opening of an EDF/SDF File for writing
[EDF]=sdfopen(EDF,'w') is equal to
[EDF]=sdfopen(EDF.FileName,'w',EDF.Dur,EDF.SampleRate);
At least EDF.FileName, EDF.NS, EDF.Dur and EDF.EDF.SampleRate must be defined
See also: fopen, SDFREAD, SDFWRITE, SDFCLOSE, SDFSEEK, SDFREWIND, SDFTELL, SDFEOF