<getter> return trial sample list from MEGinfo or EEGinfo [usage] trial_sample = vb_info_get_trial_sample(info, active_swt) [input] info : <required> <<struct>> MEGinfo or EEGinfo active_swt : <optional> <<boolean>> return switch [false] : true) return only active_trials : false) return all the trials [output] trial_sample : sample list of trial [Ntrial x Nsample] [note] @see vb_info_get_trial_list [hitory] 2008-04-15 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function trial_sample = vb_info_get_trial_sample(info, active_swt) 0002 % <getter> return trial sample list from MEGinfo or EEGinfo 0003 % [usage] 0004 % trial_sample = vb_info_get_trial_sample(info, active_swt) 0005 % [input] 0006 % info : <required> <<struct>> MEGinfo or EEGinfo 0007 % active_swt : <optional> <<boolean>> return switch [false] 0008 % : true) return only active_trials 0009 % : false) return all the trials 0010 % [output] 0011 % trial_sample : sample list of trial [Ntrial x Nsample] 0012 % [note] 0013 % @see vb_info_get_trial_list 0014 % [hitory] 0015 % 2008-04-15 (Sako) initial version 0016 % 0017 % Copyright (C) 2011, ATR All Rights Reserved. 0018 % License : New BSD License(see VBMEG_LICENSE.txt) 0019 0020 % --- CHECK ARGUMENTS --- % 0021 if ~exist('info', 'var'), info = []; end 0022 if ~exist('active_swt', 'var'), active_swt = []; end 0023 [info, active_swt] = inner_check_arguments(info, active_swt); 0024 0025 % --- MAIN PROCEDURE --------------------------------------------------------- % 0026 % 0027 trial_sample = []; 0028 trial_list = vb_info_get_trial_list(info, [], active_swt); 0029 0030 if isempty(trial_list) 0031 return; 0032 end 0033 0034 n_trial = length(trial_list); 0035 n_sample = length(info.Trial(1).sample); 0036 trial_sample = zeros(n_trial,n_sample); 0037 for i_trial = n_trial 0038 trial_sample(i_trial,:) = info.Trial(trial_list(i_trial)).sample; 0039 end 0040 return; 0041 % 0042 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0043 0044 0045 % --- INNER FUNCTIONS -------------------------------------------------------- % 0046 % 0047 % --- inner_check_arguments() 0048 % 0049 function [info, active_swt] = inner_check_arguments(info, active_swt) 0050 func_ = mfilename; 0051 if isempty(info) 0052 error('(%s)info is a required parameter', func_); 0053 end 0054 0055 if isempty(active_swt) 0056 active_swt = false; 0057 end 0058 return; 0059 % 0060 % --- end of inner_check_arguments() 0061 % 0062 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0063 0064 %%% END OF FILE %%%