Setting PLV output names in Brainstorm in script

Hi, is there a way to use the ‘Comment’ segment in the script to automatically generate the names of output PLV data in Brainstorm interface? (I know the actual filenames are not changed) I am running PLV analysis twice for each subject visit (two different time segments), and it would be nice to run everything together and have the outputs automatically named ex) plv_1, plv_2 for organization sake. Not the biggest deal, but I’m hoping to save some time and prevent room for error by manually editing the names.

Below is a portion of the current script, which doesn’t seem to be doing anything.

% Process: PLV: Phase locking value

sFiles = bst_process('CallProcess', 'process_plv1n', sFiles, [] , ...
'subjectname',  SubjectName, ...
'timewindow',   [ 206.166 ,	326.179 ], ...
'scouts',       {'Desikan-Killiany', {'caudalmiddlefrontal L', 'caudalmiddlefrontal R', 'cuneus L', 'cuneus R', 'inferiortemporal L', 'inferiortemporal R', 'insula L', 'insula R', 'parstriangularis L', 'parstriangularis R', 'postcentral L', 'postcentral R', 'precentral L', 'precentral R', 'superiorfrontal L', 'superiorfrontal R', 'superiorparietal L', 'superiorparietal R', 'superiortemporal L', 'superiortemporal R', 'supramarginal L', 'supramarginal R'}}, ...
'scoutfunc',    1, ...
'scouttime',    2, ...
'freqbands',    {'delta', '2, 4', 'mean'; 'theta', '5, 7', 'mean'; 'alpha', '8, 12', 'mean'; 'beta', '15, 29', 'mean'; 'gamma1', '30, 59', 'mean'; 'gamma2', '60, 90', 'mean'}, ...
'plvmethod',    'plv', ...
'keeptime',     0, ...
'plvmeasure',   2, ...
'outputmode',   1, ...
'edit', struct(...
'Comment',      'closed_plv_V1'));  % VISIT 1 %

I’ve also tried this, which didn’t work:

% Process: PLV: Phase locking value

sFiles = bst_process('CallProcess', 'process_plv1n', sFiles, \[\], ...
'subjectname',  SubjectNames{1}, ... % Added the 'subjectname' per Jay's reference
'timewindow',   [starttime, endtime], ... % Different time window for each subject
'scouts',       {'Desikan-Killiany', {'caudalmiddlefrontal L', 'caudalmiddlefrontal R', 'cuneus L', 'cuneus R', 'inferiortemporal L', 'inferiortemporal R', 'insula L', 'insula R', 'parstriangularis L', 'parstriangularis R', 'postcentral L', 'postcentral R', 'precentral L', 'precentral R', 'superiorfrontal L', 'superiorfrontal R', 'superiorparietal L', 'superiorparietal R', 'superiortemporal L', 'superiortemporal R', 'supramarginal L', 'supramarginal R'}}, ...
'scoutfunc',    1, ...  % Mean
'scouttime',    2, ...  % After
'freqbands',    {'delta', '2, 4', 'mean'; 'theta', '5, 7', 'mean'; 'alpha', '8, 12', 'mean'; 'beta', '15, 29', 'mean'; 'gamma1', '30, 59', 'mean'; 'gamma2', '60, 90', 'mean'}, ...
'plvmethod',    'plv', ...  % PLV: Phase locking value
'keeptime',     0, ...
'plvmeasure',   2, ...  % Magnitude
'outputmode',   1, ... % Save individual results (one file per input file)
'Comment',      'closed_plv_V1');  % VISIT 1 %

The output comment cannot be set like that as there is not such a Comment option the process you are using.

You can use the process_set_comment in the GUI this is found in Processes > File > Set Name

% Process: Set name: YOURNAME
sFiles = bst_process('CallProcess', 'process_set_comment', sFiles, [], ...
    'tag',           'YOURNAME', ...
    'isindex',       1);

Here you have two options:

  1. Calling process_set_comment twice (one sFile at the each run), and set different names in each run, or

  2. Calling process_set_comment once (with both sFiles), and set a base name. The files will be named: YOURNAME (#1) and YOURNAME (#2). The option isindex must be 1 to have this behaviour, otherwise, both files will have the same name without the (#x) indicator.

Ah, thank you very much.