Import MEG/EEG and import from Matlab script

Dear Experts,

I'm new to Brainstorm and I want to import EEG data (.set) for each folder, like this, but I can't find the script.

Also, when there is a TF file, how can I import a new file to overwrite the original one by scripting like this?


Hi @wangchenyu, have you encounter the scripting tutorial?
It explains, how to generate an script directly from a process, and how to directly interact with the files in Brainstorm DB.

For this one, you could do it through one of these process:
Import > Import recordings > Import MEG/EEG: Time\Events\Epochs
And then Generate a *.m script

For this case, there is not a direct process. So the idea would be to:

  1. Export the TF file to Matlab with:
    sTimefreqmat = export_matlab(filename)
    export_matlab(filename, 'sTimefreqmat');
  2. Do you modifications
  3. Import the modified TF from Matlab
    db_add(iStudy, sTimefreqmat, 1)

Thanks for your reply. There're still some problems.
I want to import epochs for each condition, which have been preprocessed in eeglab, but there are something wrong when I try to click import MEG/EEG: existing epochs. I think I need more tutorials.

For another,

When I use this code, the error message from Matlab is that there are too many output parameters. I just type export_matlab(filename) then run it correctly but I still need to enter the name of the workspace variable.

Thanks a lot!

This process is to automate the importing of the EEGLAB epoch, thus, when you run it be sure that there is not files in the Process tab area.


Apologies, I shared incorrect syntax. It should be as below.
It will export a given file to the Matlab environment using a given variable name.

export_matlab(filename, 'sTimefreqmat');