Home > bml > annot > bml_annot_extend.m

bml_annot_extend

PURPOSE ^

BML_ANNOT_EXTEND extends the annotation times

SYNOPSIS ^

function extended = bml_annot_extend(annot,ext1,ext2)

DESCRIPTION ^

 BML_ANNOT_EXTEND extends the annotation times

 Use as
   extended = bml_annot_extend(annot,ext1,ext2)
   extended = bml_annot_extend(annot,[ext1,ext2])
   extended = bml_annot_extend(annot,ext1)

 Positive ext1 extends the begging of the annotation (starts at an earlier
 time). Negative ext1 contracts the begging, i.e. starts at a later time.
 Likewise, positive ext2 ext ends the end of the annotation (ends at a later time)
 and negative ext2 contracts the end (ends at an earlier time).

 If ext2 is not specified, it is set to ext1

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function extended = bml_annot_extend(annot,ext1,ext2)
0002 
0003 % BML_ANNOT_EXTEND extends the annotation times
0004 %
0005 % Use as
0006 %   extended = bml_annot_extend(annot,ext1,ext2)
0007 %   extended = bml_annot_extend(annot,[ext1,ext2])
0008 %   extended = bml_annot_extend(annot,ext1)
0009 %
0010 % Positive ext1 extends the begging of the annotation (starts at an earlier
0011 % time). Negative ext1 contracts the begging, i.e. starts at a later time.
0012 % Likewise, positive ext2 ext ends the end of the annotation (ends at a later time)
0013 % and negative ext2 contracts the end (ends at an earlier time).
0014 %
0015 % If ext2 is not specified, it is set to ext1
0016 
0017 if nargin == 2
0018   if length(ext1)==2
0019     ext2=ext1(2);
0020     ext1=ext1(1);
0021   elseif length(ext1)==1
0022     ext2=ext1;
0023   else 
0024     error('incorrect call. See usage')
0025   end
0026 elseif nargin ~= 3
0027   error('incorrect call. See usage')
0028 end
0029 
0030 annot = bml_annot_table(annot);
0031 annot.starts = annot.starts - ext1;
0032 annot.ends = annot.ends + ext2;
0033 
0034 extended = bml_annot_table(annot);
0035 
0036 
0037 
0038

Generated on Tue 25-Sep-2018 10:08:19 by m2html © 2005