Dear all,
I am trying to write a script to export multiple connectivity matrices. I have computed the connectivity (coherence) for my data, averaged the values in six frequency bands, and now I would like to export these six matrices.
So far my script looks like this:
for i = 1:4 % for each condition
% Input files
sFiles = [];
SubjectNames = {...
'All'};
% Start a new report
bst_report('Start', sFiles);
% Process: Select timefreq files in: */type41, type21/tfbands
sFiles = bst_process('CallProcess', 'process_select_files_timefreq', sFiles, [], ...
'subjectname', SubjectNames{1}, ...
'condition', condition_labs{i}, ...
'tag', 'Coh', ...
'includebad', 0, ...
'includeintra', 0, ...
'includecommon', 0);
% Select only the full coherence file
sFiles = bst_process('CallProcess', 'process_select_tag', sFiles, [], ...
'tag', 'AllBands', ...
'search', 2, ... % Search the file comments
'select', 1);
[~, n_subj] = size(sFiles);
for j = 1:n_subj
subj_number = regexp(sFiles(j).SubjectName,'\d*','Match');
filename_out = [path_out filesep 'S_' subj_number{1} '_' 'source_cohere_' condition_names{i} '.csv'];
export_timefreq(sFiles(j).FileName, filename_out, 'ASCII-CSV-HDR');
end
end
The problem with this script is that it prompts a GUI window that asks to select the frequency to export within the ones available. I have looked through the export_timefreq.m code but unfortunately I was not able to understand how to tell the function which frequency to export.
Thanks for the help,
Antonio