return trial length by sample number [usage] [len] = vb_samplelist_get_trial_len(sample_list) [input] sample_list : <required> <<struct>> [1 x Ntrial] array of from-to : .from : start sample number : .to : end sample number [output] len : number of sample of single trial [note] [history] 2008-01-30 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [len] = vb_samplelist_get_trial_len(sample_list) 0002 % return trial length by sample number 0003 % [usage] 0004 % [len] = vb_samplelist_get_trial_len(sample_list) 0005 % [input] 0006 % sample_list : <required> <<struct>> [1 x Ntrial] array of from-to 0007 % : .from : start sample number 0008 % : .to : end sample number 0009 % [output] 0010 % len : number of sample of single trial 0011 % [note] 0012 % 0013 % [history] 0014 % 2008-01-30 (Sako) initial version 0015 % 0016 % Copyright (C) 2011, ATR All Rights Reserved. 0017 % License : New BSD License(see VBMEG_LICENSE.txt) 0018 0019 % --- CHECK ARGUMENTS --- % 0020 if ~exist('sample_list', 'var'), sample_list = []; end 0021 [sample_list] = inner_check_arguments(sample_list); 0022 0023 % --- MAIN PROCEDURE --------------------------------------------------------- % 0024 % 0025 % length of each trials are the same 0026 len = sample_list(1,2) - sample_list(1,1) + 1; 0027 return; 0028 % 0029 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0030 0031 % --- INNER FUNCTIONS -------------------------------------------------------- % 0032 % 0033 % --- inner_check_arguments() 0034 % 0035 function [sample_list] = inner_check_arguments(sample_list) 0036 func_ = mfilename; 0037 0038 if isempty(sample_list) 0039 error('(%s)sample_list is a required parameter', func_); 0040 end 0041 0042 % if ~isfield(sample_list, 'from') || ~isfield(sample_list, 'to') 0043 % error('(%s)sample_list is invalid', func_); 0044 % end 0045 return; 0046 % 0047 % --- end of inner_check_arguments() 0048 % 0049 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0050 0051 %%% END OF FILE %%%