Export more than one file as .mat

Hi Francois,

I have simple question.
I want to export 50 time-frequency data in a condition. when I right click on a trial to export the data, I get a menu “Export to file”. If I select this option, I can export one time-frequency data and get “timefreq_trial No_marlet_ No.mat” file as Matlab data. In this case, file name is the original file name. But if I right click on more than one trials from the same condition, I can not get the option.

Now I have 50data x 2conditions x 15subjects. To export 50 time-frequency data one by one is too hard.
It would be helpful if you had any advice.
I am new to operate Matlab.

Best regards,
Jun

Hi Jun,

You could try using a script. First use a selection process in the File section, generate the corresponding script. Example:

sFiles = bst_process('CallProcess', 'process_select_files_timefreq', sFiles, [], ...
    'subjectname',   SubjectNames{1}, ...
    'condition',     '', ...
    'tag',           '', ...
    'includebad',    0, ...
    'includeintra',  1, ...
    'includecommon', 0);

Then export the files using the function export_timefreq:

for i = 1:length(sFiles)
    outFilename = fullfile(outDir, strrep(sFiles(i).FileName, '/', '_'));
    export_timefreq(sFiles(i).FileName, outFilename, 'BST');
end

For additional help with scripting in Brainstorm, you can refer to this tutorial:
http://neuroimage.usc.edu/brainstorm/Tutorials/Scripting

Cheers,
Francois

Hi Francois,

thank you fro your reply.
I’ll try based on your advice.

Best,
Jun