Home > functions > device > trigger_timing > vb_onset_check.m

vb_onset_check

PURPOSE ^

Check onset time

SYNOPSIS ^

function [jx, jj] = vb_onset_check(ix,t_length)

DESCRIPTION ^

 Check onset time 
 --- condition for onset
 Time length to previous onset shoud be larger than 't_length'
    [jx, jj] = vb_onset_check(ix,t_length)
 --- input
 ix : onset time index
 t_length : time length
 --- Output
 jx : extracted onset time index
 jj : extracted index : jx = ix(jj)
      
 2011-12-16 Masa-aki Sato

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [jx, jj] = vb_onset_check(ix,t_length)
0002 % Check onset time
0003 % --- condition for onset
0004 % Time length to previous onset shoud be larger than 't_length'
0005 %    [jx, jj] = vb_onset_check(ix,t_length)
0006 % --- input
0007 % ix : onset time index
0008 % t_length : time length
0009 % --- Output
0010 % jx : extracted onset time index
0011 % jj : extracted index : jx = ix(jj)
0012 %
0013 % 2011-12-16 Masa-aki Sato
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 N  = length(ix);
0019 jj = 1;
0020 jx = ix(1);
0021 
0022 ipre = ix(1);
0023 
0024 for n=2:N
0025     dx = ix(n) - ipre;
0026     if dx >= t_length
0027         jx = [jx, ix(n)];
0028         jj = [jj, n];
0029         ipre = ix(n);
0030     end
0031 end
0032 
0033 return
0034

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005