MATLAB File Help: rdann View code for rdann WFDB Contents
rdann



function varargout=rdann(varargin)

 [ann,anntype,subtype,chan,num,comments]=rdann(recordName, annotator, C, N, N0, AT)

    Wrapper to WFDB RDANN:
         http://www.physionet.org/physiotools/wag/rdann-1.htm

 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.

 Reads a WFDB annotation and returns:


 ann
       Nx1 integer vector of the annotation locations in samples
       with respect to the beginning of the record. 
       To convert this vector to a string of time stamps see WFDBTIME.

 anntype
       Nx1 character vector describing the annotation types.
       For a list of standard annotation codes used by PhyioNet, see:
             http://www.physionet.org/physiobank/annotations.shtml

 subtype
       Nx1 integer vector describing annotation subtype.
       
 chan
       Nx1 integer vector describing annotation channel.

 num
       Nx1 integer vector describing annotation NUM.

 comments
       Nx1 cell of strings describing annotation comments.


 Required Parameters:

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

 annotator
       String specifying the name of the annotation file in the WFDB path or
       in the current directory.

 Optional Parameters are:

 C
       An integer scalar. Return only the annotations with chan = C.
 N
       An integer specifying the sample number at which to stop reading the
       record file. Default read all.
 N0
       A 1x1 integer specifying the sample number at which to start reading the
       annotion file. Default = 1, begining of the record.

 AT
       The anntype character. Return only annotations with subtype = S. 
       Default is empty, which returns all annotations.



 **OPTIMIZATION NOTE: This function has been optimized for cases in which
 only the annotation sample vector is required, ie for function calls of
 the type:

  ann=rdann(recordName, annotator, C, N, N0, AT);

  For these cases, no string parsing is required and the formatting is
  done at the Java level, increasing substantially the processing speed.



 Written by Ikaro Silva, 2013
 Last Modified: January 4, 2017
 Version 2.1
 Since 0.0.1

 %Example 1- Read a signal and annotation from PhysioNet's Remote server:
[signal,Fs,tm]=rdsamp('challenge/2013/set-a/a01');
[ann]=rdann('challenge/2013/set-a/a01','fqrs');
plot(tm,signal(:,1));hold on;grid on
plot(tm(ann),signal(ann,1),'ro','MarkerSize',4)

%Example 2- Read annotation from the first 500 samples only
 ann=rdann('mitdb/100','atr',[],500);


%Example 3- Read annotations with anntype = 'V' only. 
 annV=rdann('mitdb/100', 'atr', [],[],[],'V');


 See also wfdbtime, wrann