MATLAB File Help: wrann | View code for wrann | WFDB Contents

wrann

    function varargout=wrann(varargin)

     wrann(recordName,annotator,ann,anntype,subtype,chan,num,comments)

        Wrapper to WFDB WRANN:
             http://www.physionet.org/physiotools/wag/wrann-1.htm

     Writes data into a WFDB annotation file. The file will be saved at the
     current directory (if the record is in the current directory) or, if a using
     a PhysioNet web record , a subdirectory in the current directory, with
     the relative path determined by recordName. The files will have the
     name 'recordName" with the 'annotator' extension. You can use RDANN to
     verify that the write was completed sucessfully (see example below).

     NOTE: The WFDB Toolbox uses 0 based index, and MATLAB uses 1 based index.
           Due to this difference annotation values ('ann') are shifted inside
           this function in order to be compatible with the WFDB native
           library. The MATLAB user should leave the indexing conversion to
           the WFDB Toolbox.

     Required Parameters:

     recordName
           String specifying the name of the record in the WFDB path or
           in the current directory.

     annotator
           String specifying file extension of the annotation file to be
           written.

     ann
           Nx1 integer vector containing the sample numbers of the annotations
           with respect to the begining of the record. Samples must be >=1.

     anntype
           Nx1 (single) character vector, or single character, describing each annotation type.
           Default is 'N'. For a list of standard annotation codes used by PhyioNet,
           please see: http://www.physionet.org/physiobank/annotations.shtml
           If the description is longer than one character, use the 'comments'
           field.

     subtype
           Nx1 integer vector, or single scalar, describing annotation subtype.
           Default is '0'. Range must be from -128 to 127.

     chan
           Nx1 integer vector, or single scalar, describing annotation CHAN.
           Default is 0. Range must be from 0 to 255.

     num
           Nx1 integer vector, or single scalar, describing annotation NUM.
           Default is 0. Range must be from -128 to 127.

     comments
           Nx1 or single cell of strings describing annotation comments.
           Default is blank {''}.

     Note: annType, subType, chan, num, and comments can be of dimension Nx1
     or 1x1. If they are 1x1, this function will repeat the element N times.

    %Example- Creates a *.test file in your current directory
    [ann,type,subtype,chan,num]=rdann('challenge/2013/set-a/a01','fqrs');
     wrann('challenge/2013/set-a/a01','test',ann,type,subtype,chan,num)

     %Reading the file again should give the same results
    [ann,type,subtype,chan,num]=rdann('challenge/2013/set-a/a01','fqrs');
    wrann('challenge/2013/set-a/a01','test',ann,type,subtype,chan,num);
    [ann2,type2,subtype2,chan2,num2]=rdann('challenge/2013/set-a/a01','test',[],[],1);
    err=sum(ann ~= ann2)

     %Example 2
    [ann,type,subtype,chan,num]=rdann('mitdb/100','atr');
    wrann('mitdb/100','test',ann,type,subtype,chan,num);

     Written by Ikaro Silva, 2013
     Last Modified: November 4, 2014
     Version 1.4
     Since 0.0.1

     See also RDANN, RDSAMP, WFDBDESC