0001 function [data] = vb_signal_processor_create_output_filename(data)
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 if ~exist('data', 'var')
0017     error('data is a required parameter.');
0018 end
0019 
0020 
0021 
0022 
0023 H = data.H;
0024 
0025 def = vb_define_extension;
0026 switch(data.file_type)
0027     case 'MEG'
0028         extension = def.MEG2_EXTENSION;
0029     case 'EEG'
0030         extension = def.EEG_EXTENSION;
0031 end
0032 
0033 output_dir = get(H.output_dir_edit, 'String');
0034 specific_output_place = false;
0035 if ~isempty(output_dir)
0036     specific_output_place = true;
0037 end
0038 
0039 
0040 
0041 files     = data.input_files;
0042 Nfiles    = length(files);
0043 output_files = cell(0);
0044 
0045 for k=1:Nfiles
0046     file = files{k};
0047     [d_, f_, e_] = vb_get_file_parts(strrep(file, extension, ''));
0048     if specific_output_place
0049         d_ = output_dir;
0050     end
0051     
0052     file_out = fullfile(d_, [f_, data.postfix, extension]);
0053     output_files{k} = file_out;
0054 end
0055 data.output_files = output_files;
0056 
0057 
0058 
0059 
0060 if nargout ~= 1
0061     error('function caller should receive application data object.');
0062 end