Home > functions > gui > preAnalysis > trial_extractor > vb_trial_extractor_input_multi_pattern.m

vb_trial_extractor_input_multi_pattern

PURPOSE ^

Input multi channel pattern.

SYNOPSIS ^

function [data] = vb_trial_extractor_input_multi_pattern(data)

DESCRIPTION ^

 Input multi channel pattern.
 [USAGE]
    [data] = vb_trial_extractor_input_multi_pattern(data);
 [IN]
    data : vb_trial_extractor object.
 [OUT]
    data : updated vb_trial_extractor object.

 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 [data] = vb_trial_extractor_input_multi_pattern(data)
0002 % Input multi channel pattern.
0003 % [USAGE]
0004 %    [data] = vb_trial_extractor_input_multi_pattern(data);
0005 % [IN]
0006 %    data : vb_trial_extractor object.
0007 % [OUT]
0008 %    data : updated vb_trial_extractor object.
0009 %
0010 % Copyright (C) 2011, ATR All Rights Reserved.
0011 % License : New BSD License(see VBMEG_LICENSE.txt)
0012 
0013 %
0014 % --- Previous check
0015 %
0016 if ~exist('data', 'var')
0017     error('data is a required parameter.');
0018 end
0019 
0020 %
0021 % --- Main Procedure
0022 %
0023 H = data.H;
0024 
0025 % get selected trigger channel
0026 ex_ch_list = get(H.trigger_channel_listbox, 'String');
0027 if isempty(ex_ch_list), return; end
0028 sl_ch_list = ex_ch_list(get(H.trigger_channel_listbox, 'Value'));
0029 if ~iscellstr(sl_ch_list)
0030     sl_ch_list = {sl_ch_list};
0031 end
0032 Nch_sl = size(sl_ch_list, 1);
0033 
0034 %                 strmatch                find
0035 % Selected channel ------> Table channel -----> flag on table channel
0036 table_ix = [];
0037 table_ex_ch_list = data.multi_channel_pattern(:,1);
0038 for k=1:Nch_sl
0039     % find index of selected channel from channel pattern table.
0040     table_ix = [table_ix; strmatch(sl_ch_list{k}, table_ex_ch_list, 'exact')];
0041 end
0042 
0043 if ~isempty(table_ix)
0044     flag_list = [data.multi_channel_pattern{:,2}]';
0045     % find flag on channel from selected channel.
0046     table_ix_flag_on = find(flag_list == 1);
0047     if isempty(table_ix_flag_on)
0048         flag_on_ch = [];
0049     else
0050         flag_on_ch = table_ex_ch_list(table_ix_flag_on);
0051     end
0052     [flag_on_ch, cancel] = vb_te_channel_selector_new(sl_ch_list, flag_on_ch);
0053 end
0054 
0055 if cancel == false
0056     for k=1:length(table_ix)
0057         if ~isempty(flag_on_ch) && ...
0058            ~isempty(strmatch(table_ex_ch_list{table_ix(k)}, flag_on_ch, 'exact'))
0059             data.multi_channel_pattern{table_ix(k), 2} = 1;
0060         else
0061             data.multi_channel_pattern{table_ix(k), 2} = 0;
0062         end
0063     end
0064 end
0065         
0066 %
0067 % --- After check
0068 %
0069 if nargout ~= 1
0070     error('function caller should receive this object.');
0071 end

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