Hello,
I am trying to run a matlab script using Brainstorm functions, and I would like to use a 'parfor' loop for parallel processing. However, every time I try I get the same error and I guess I am doing something wrong. I include below a simplified version of my script:
addpath('/xx/brainstorm3')
brainstorm
parpool()
participant = {'2262'};
session = {'A' 'B' 'C' 'D'};
for p = 1:length(participant)
parfor s = 1:length(session)
sFiles = {...
['2262/@raw2262' session{s} '_Click_run1_mc_tsss_AMICA_matlab_high/data_0raw_2262' session{s} '_Click_run1_mc_tsss_AMICA_matlab_high.mat'], ...
['2262/@raw2262' session{s} '_Click_run2_mc_tsss_AMICA_matlab_high/data_0raw_2262' session{s} '_Click_run2_mc_tsss_AMICA_matlab_high.mat']};
sFiles = bst_process('CallProcess', 'process_import_data_event', sFiles, [], ...
'subjectname', participant{p}, ...
'condition', '', ...
...% 'datafile', RawFiles, ...
'eventname', ['EEG_MLR_11' session{s}], ...
'timewindow', [], ...
'epochtime', [-0.05, 0.1], ...
'createcond', 1, ...
'ignoreshort', 1, ...
'channelalign', 0, ...
'usectfcomp', 0, ...
'usessp', 1, ...
'freq', [], ...
'baseline', []);
end
end
It works just fine if in the second for loop I use 'for' instead of 'parfor'. If I use 'parfor', this is the error I get, despite Brainstorm being started.
Error using bst_process>CallProcess (line 2104)
Please start Brainstorm before calling bst_process().
Error in bst_process (line 36)
eval(macro_method);
Any help would be really appreciated,
Many thanks,
Fran