Main Content

deleteAnnotations

Delete annotations from EDF or EDF+ file

Since R2021a

    Description

    example

    edfw = deleteAnnotations(edfw,annotationindices) deletes the annotations at the indices specified in annotationindices from the European Data Format (EDF) or EDF+ file.

    edfw = deleteAnnotations(edfw) deletes all the annotations present in edfw.

    Examples

    collapse all

    Load an edfwrite object into the workspace that contains a timetable with 28 annotations. Each annotation corresponds to the onset of one of six arm motions or a rest period:

    • Hand open – "1"

    • Hand close – "2"

    • Wrist flexion – "3"

    • Wrist extension – "4"

    • Supination – "5"

    • Pronation – "6"

    • Rest – "7"

    load edfw

    Delete the rest periods ("7") from edfw and view the annotations timetable. There are 22 annotations remaining and no instances of rest.

    idx = find(edfw.Annotations.Annotations == "7");
    edfw = deleteAnnotations(edfw,idx);
    edfw.Annotations
    ans=22×2 timetable
          Onset       Annotations    Duration
        __________    ___________    ________
    
        12.257 sec        "3"         3 sec  
        32.32 sec         "6"         3 sec  
        40.449 sec        "1"         3 sec  
        51.202 sec        "2"         3 sec  
        70.404 sec        "4"         3 sec  
        79.84 sec         "1"         3 sec  
        89.327 sec        "4"         3 sec  
        109.26 sec        "2"         3 sec  
        118.8 sec         "1"         3 sec  
        128.8 sec         "6"         3 sec  
        138.42 sec        "5"         3 sec  
        157.55 sec        "4"         3 sec  
        166.78 sec        "3"         3 sec  
        176.71 sec        "5"         3 sec  
        196.42 sec        "1"         3 sec  
        206.31 sec        "3"         3 sec  
          ⋮
    
    

    Create a region-of-interest (ROI) table that contains the remaining annotations. Convert the duration arrays to double arrays.

    anns = edfw.Annotations;
    region = seconds([anns.Onset anns.Onset+anns.Duration]);
    label = anns.Annotations;
    roi = table(region,label)
    roi=22×2 table
             region         label
        ________________    _____
    
        12.257    15.257     "3" 
         32.32     35.32     "6" 
        40.449    43.449     "1" 
        51.202    54.202     "2" 
        70.404    73.404     "4" 
         79.84     82.84     "1" 
        89.327    92.327     "4" 
        109.25    112.25     "2" 
        118.81    121.81     "1" 
         128.8     131.8     "6" 
        138.42    141.42     "5" 
        157.55    160.55     "4" 
        166.78    169.78     "3" 
        176.71    179.71     "5" 
        196.43    199.43     "1" 
        206.31    209.31     "3" 
          ⋮
    
    

    Load the electromyography (EMG) data [1] related to the annotations. The data is available at www.sce.carleton.ca/faculty/chan/index.php?page=matlab. The sample rate is 1000 Hz. Create a signal variable that contains only the first channel of data.

    load EMGdata
    fs = 1000;
    x = data(:,1);

    Create a signal mask for the regions of interest and motion labels. Plot the EMG signal along with the annotation regions.

    msk = signalMask(roi,"SampleRate",fs);
    plotsigroi(msk,x)

    Input Arguments

    collapse all

    EDF or EDF+ file, specified as an edfwrite object.

    Annotation indices, specified as a numeric vector. The values in annotationindices must be row indices of the Annotations property.

    Data Types: double

    Output Arguments

    collapse all

    EDF or EDF+ file, returned as an edfwrite object.

    References

    [1] Chan, Adrian D.C., and Geoffrey C. Green. 2007. "Myoelectric Control Development Toolbox". Paper presented at 30th Conference of the Canadian Medical & Biological Engineering Society, Toronto, Canada, 2007.

    [2] 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.

    [3] 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