make new name of new headfile [USAGE] new_file = vb_join_cell_file_name(filename); [IN] filename : filename list {1xN}, {Nx1} [OUT] new_file : joined filename. example: filename = {'/home/test/test.eeg.mat', ... '/abc/test2.hdr', ... './abc3021.mat'}; new_file : '/home/test/test_test2_abc3021' Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function new_file = vb_join_cell_file_name(filename) 0002 % make new name of new headfile 0003 % [USAGE] 0004 % new_file = vb_join_cell_file_name(filename); 0005 % [IN] 0006 % filename : filename list {1xN}, {Nx1} 0007 % [OUT] 0008 % new_file : joined filename. 0009 % 0010 % example: 0011 % filename = {'/home/test/test.eeg.mat', ... 0012 % '/abc/test2.hdr', ... 0013 % './abc3021.mat'}; 0014 % new_file : 0015 % '/home/test/test_test2_abc3021' 0016 % 0017 % 0018 % Copyright (C) 2011, ATR All Rights Reserved. 0019 % License : New BSD License(see VBMEG_LICENSE.txt) 0020 if ~iscell(filename) 0021 new_file = filename; 0022 return; 0023 end 0024 0025 for nf = 1:length(filename) 0026 fname_body = vb_util_get_file_body(filename{nf}); 0027 if nf==1 0028 new_file = [fname_body]; 0029 else 0030 new_file = [new_file '_' fname_body]; 0031 end 0032 end 0033 0034 [fdir,fbody] = vb_get_file_parts(filename{1}); 0035 0036 if ~isempty(fdir) 0037 new_file = [fdir '/' new_file ]; 0038 end