Load, edit and save Brainstorm source files

I want to test my own source inversion method. Following the tutorial, I need to copy the provided source structure files and replace their amplitude attributes with my own solution via the Brainstorm (BST) app's interface. However, manually copying the files is quite time-consuming.

I would like to write my own script to automate this: copying the structure files from a specified directory in MATLAB, modifying their content, and then reloading them into the BST application. Is there a way to achieve this workflow?

Yes, please check the Scripting tutorial, it has all the information that you need:

You can also check this script, it does:

  • Import source file
  • Update the value of the sources
    (It updates just few sources, but in your case the update will be for all sources)
  • Save back the result
  • Update Brainstorm database