Process_average outputs 2 files instead of 1

Thank you Martin for your reply,

I did not use the option you mentioned, I will try this as soon as I retrieve access to my database. However the behavior I observed still seems unexpected to me, so maybe it is worth understanding what happens? I had used the following matlab code:

sFilesGrandAvg = bst_process('CallProcess', 'process_average', sFilesAvg, [], ...
'avgtype', 7, ... % By trial group (grand average)
'avg_func', 1, ... % Arithmetic average: mean(x)
'weighted', 0, ...
'keepevents', 0);

I realize choosing 'avgtype' as 'By folder (grand average)' was maybe more appropriate, and I will have to check what happens with this setting too. But why does the option 'By trial group (grand average)' result in 2 files, and not 1 or 30, or any other number? I don't understand how the files get grouped here.