Importing FieldTrip Preprocessed EEG (.mat) Files

Dear Brainstorm developers and users,

Although I tried many times to proceed, I was not able to import and detect the event information of my FieldTrip preprocessed (.mat) files for decoding. Is there any way to do so at the moment?

I'd greatly appreciate any of your input and help.

Thank you so much in advance.

Indeed, the function in_data_fieldtrip.m does not read any event from the FieldTrip structure:

It is probably easy to add a few lines to this function to read the events you are interested in.
Can you please share an example file?

  • upload the FieldTrip .mat file somewhere
  • post the download link here
  • describe precisely what structure of the file you would like to read, and how you would like this information to be available in Brainstorm

Hello Brainstorm developers and users,

I've been trying to import my preprocessed FieldTrip .mat file into Brainstorm for decoding analysis. However, I'm receiving this error: "Cannot open multiple trials as continuous files, use the menu "Import MEG/EEG" instead".

When I use that menu, I'm not able to see my event information as well. Is there any way to solve this problem?

Thank you so much for your input and help in advance.

Kind regards,

Please avoid posting multiple times the same questions - thanks


I've attached an example file below. I have defined 48 triggers as event values and epoch beforehand. Each 48 condition has 53 trials and in total I have 2544 time points. I'm trying to assign first 24 triggers to one class and other 24 to another, however, I'm not able to access to them while using Brainstorm interface. I kindly want Brainstorm to read my event values, conditions to be able to perform decoding.

Thank you so much.

I'm sorry for this, I'm new to this platform and I thought my previous post was not successfully posted. I'll be more careful about this. Thank you.

If I would learn whether the example file is available to download, I'd greatly appreciate it. Thank you for your help in advance.

I added an option to use the field trialinfo from the FieldTrip structure.
In interactive mode (when importing from the GUI), it would ask for a confirmation of which column of the trialinfo field to use. Click 'None' to ignore the trial classification.
In non-interactive mode (importing from a process), it would use the first column as the trial classification.

Update Brainstorm to get this new commit:



Dear François, I would like to thank you so much for your effort and consideration to make this change. However, I still would like to ask a relevant question: what I'm trying to achieve can be found in the Brainstorm Decoding tutorial under "Import the recordings" section. I'm trying to get one raw preprocessed file and "events" information while using GUI to follow the steps in the decoding tutorial. Is it possible to read the preprocessed file in this way and make relevant changes?

Thank you so much in advance.

Right-click on the subject > Import MEG/EEG, select the .mat file you sent me, and you'll get access to your trials correctly grouped by trialinfo.
You can use this for running the decoding processes in Brainstorm.

I've tried to import by paying attention to your instruction, however, I'm still not able to see one raw file and event information associated with them.
Screenshot at Dec 15 17-32-54

In other words, what I mean by "events" is the event codes shown here in the tutorial: Screenshot at Dec 15 17-36-38

I'm trying to achieve the same scenario with my EEG data using the GUI

Update Brainstorm again, you don't have the updates I posted yesterday, the title bar must indicate "Brainstorm 15-Dec-2021".
Then right-click on the SUBJECT > Import MEG/EEG.

Or are you using the compiled version of Brainstorm (without Matlab)?

Yes, indeed, I've done that but somehow I'm still not able to see the event markers on the right column. As you can see in that image, it should be updated.

dec 15

I'm using it with MATLAB and I'm trying to see event codes like in this image

Screenshot at Dec 15 17-36-38

The folder name Default indicates that you did not import by right-clicking directly on the SUBJECT folder. Otherwise, the folder would be named subj01_preprocess, as in my previous screen captures.

When the message shows up, you must click on the button '1'.

This will import 48 groups of 53 trials each, named after the info in the field trialinfo in the file.

If something else is happening: there is something wrong with your Brainstorm distribution.
In the Matlab command window, type edit in_data_fieldtrip.m. If line 86 is something else than 'A field "trialinfo" with ' num2str(nCol) ' column(s) is avaiable in the file.' 10 10 ... then you should delete all your installs of brainstorm (all the brainstorm3 folders), download a new version from the website.

Make sure you delete everything that is not related with the native Matlab installation when you start Matlab, in order to avoid any interference with various toolboxes or software versions.

Dear François, I've checked the line 86 and it's exactly the same, now everything is working well, thank you. However, I still cannot see the event codes on the right section below "Events" like in the decoding tutorial. Is there any possibility that Brainstorm reads and creates those event codes so that I can classify them as groups? Also is it possible to see the subject file as a single file like in the tutorial? Thank you

Your file is already epoched. What you have in this .mat file are trials already segmented, the event is at t=0 in each of the epochs. This actual event markers are not not available in the .mat file anymore, it becomes implicit when epoching the file. We will not add these markers artificially back in the epochs when importing FieldTrip files in Brainstorm.

If you are familiar with this concept, please start by following all the introduction tutorials:

If you want to get a single continuous file with event markers visible in the Record tab:
link the continuous file in Brainstorm database, and do the preprocessing in Brainstorm, as illustrated in the introduction tutorials.

1 Like

Thank you for all the help and informative answers.