0001 function [data] = vb_trial_extractor_add_tag_to_output_list(data, tag_id_list)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 if ~exist('data', 'var')
0018 error('data is a required parameter.');
0019 end
0020 if ~exist('tag_id_list', 'var')
0021 error('tag_id_list is a required parameter.');
0022 end
0023 if size(tag_id_list, 2) ~= 1
0024 error('The shape of tag_id_list should be [Nx1]');
0025 end
0026 if length(data.label_list) == 0, return; end
0027
0028
0029
0030 Nadd = size(tag_id_list, 1);
0031 Nregister = length(data.output_file);
0032
0033 org_file = vb_continuous_file_get_filename(data.continuous_file);
0034 extension = org_file(end-8+1:end);
0035
0036
0037 base_file = strrep(org_file, extension, '');
0038
0039
0040
0041 for k=1:Nadd
0042 tag_name = vb_tag_get_tag_name(data.label_list{tag_id_list(k)});
0043 output_file = [base_file, '_', tag_name, extension];
0044 data.output_file{Nregister+k}.label_name = tag_name;
0045 data.output_file{Nregister+k}.output_file = output_file;
0046 end
0047
0048 if nargout ~= 1
0049 error('function caller should receive vb_trial_extractor object.');
0050 end