Hello
I am using the script below to extract PSD frequency bands, and I am having trouble getting them to save in one total CSV file rather than one CSV file per PSD file. Do you have any advice on how I could go about adding that to this script?
for iFile = 1 : length(sFiles)
sBandFiles = [];
for iFreqBand = 1 : size(FreqBands, 1)
% Process: Extract values: [all] 2-4Hz
sFileBand = bst_process('CallProcess', 'process_extract_values', sFiles(iFile), [], ...
'timewindow', [], ...
'freqrange', str2num(FreqBands{iFreqBand, 2}), ...
'rows', '', ...
'isabs', 0, ...
'avgtime', 0, ...
'avgrow', 0, ...
'avgfreq', 0, ...
'matchrows', 0, ...
'dim', 1, ... % Concatenate signals (dimension 1)
'Comment', '');
% Process: Add tag: delta
sFileBand = bst_process('CallProcess', 'process_add_tag', sFileBand, [], ...
'tag', FreqBands{iFreqBand, 1}, ...
'output', 'name_path'); % Add to file name and file path
% Concatenate band files
sBandFiles = [sBandFiles, sFileBand];
end
% Process: Export to file: Timefreq
bst_process('CallProcess', 'process_export_file', sBandFiles, [], ...
'exporttimefreq', {ExportDir, 'ASCII-CSV-HDR'});
% Process: Delete selected files
bst_process('CallProcess', 'process_delete', sBandFiles, [], ...
'target', 1); % Delete selected files
end