Errors to import .mat MEG/EEG files

Hello, I updated the latest version of Brainstorm (24 April 2026), which runs on MATLAB 2024b on a Mac with Apple Silicon. A few months ago, I imported a MEG/EEG files in Brainstorm without any problem.

The structure of the file includes the following folders: filename,tipo, other_channel, th, name, dataout

the latest dataout is made of others subfolders: hdr,fsample,grad, sampleinfo,trial,time,label cfg.

Now, when I try to import this file.mat I receive the error message:

Error: Line 28:  in_fopen_spm (line 28)
** SPM must be in the Matlab path to use this feature.
** Call stack:
** >in_fopen_spm.m at 28
** >in_fopen.m at 153
** >in_data.m at 107
** >import_data.m at 196
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@import_data,[ ],[ ],[ ],iStudy,iSubject) at 687

After I add the spm12 in the Matlab path, importing MEG/EEG files I have the new error message:

Error: Line 36:  in_fopen_spm (line 36)
** The two files .dat and .mat must be available in the same folder.
** Call stack:
** >in_fopen_spm.m at 36
** >in_fopen.m at 153
** >in_data.m at 107
** >import_data.m at 196
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@import_data,[ ],[ ],[ ],iStudy,iSubject) at 687

how can I solve this problem?

thanks

Carmela

Hi @car,

This information suggest that the files that you have at hand come from FieldTrip rather than SPM.

Try to import your data as FieldTrip

Dear Raimondo, thank you for your reply.

I’ve tried to import the file as MEG/EEG Fieldtrip, but I obtain this error message:

Error: Line 78: Argument to dynamic structure reference must evaluate to a valid field name.
**
** Call stack:
** >read_fieldtrip_chaninfo.m at 78
** >in_data_fieldtrip.m at 174
** >in_fopen.m at 217
** >in_data.m at 547
** >import_data.m at 196
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@import_data,[ ],[ ],[ ],iStudy,iSubject) at 687

In the Plugins window, I set FieldTrip “load “ (green dot) and spm12 installed, but “unload” (red dot). I did not have this problem before the update. Do you have any other suggestions to solve the problem?

thank you again

Hi @car,

Thank you for the error report. This was caused by some updates in the FieldTrip code that Brainstorm relies to read FieldTrip data. The issue is now solved: commit f4b64fd

Update your Brainstorm instance to 27-Apr-2026
The FieldTrip data should be imported without troubles