Error when importing eeglab raw file to brainstorm

Hello! I've just started using brainstorm and eeglab for data analysis purposes, and I have a question.
Whenever I try to import a .set file exported from eeglab i get this error:


** Error: Line 48: Reference to non-existent field 'EEG'.
**
** Call stack:
** >in_fopen_eeglab.m at 48
** >in_fopen.m at 107
** >import_raw.m at 126
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@import_raw,[],[],iSubject) at 660
**


I don't really get what the problem could be, can someone help me out?

Thank you so much already

2 Likes

The EEGLAB .set files are Matlab .mat files containing a .EEG field:

It looks like your file contains something else. How was it generated?

Please copy-paste the contents of the .set file here.
(to load it in Matlab: load('yourfile.set', '-mat'))

Hi Francois,

I am replicating this problem. It appears that newly created .set files are the contents within the .EEG field. In other words, there is no .EEG field, only the contents within them.

What do you suggest?

Thanks!
Nick

What do you have in this file?

mat = load('yourfile.set', '-mat')
view_struct(mat)

I don't understand your question, Francois. The .set file has everything that it typically has, it is just the fields are individual variables, rather than fields nested within a .EEG structure.

I can interface with the files by removing ".EEG" from in_fopen_eeglab.m, in_channel_eeglab_set.m, and in_fread_eeglab.m . However, this reduces the reversibility with older eeglab .set files. I attempted to create an if statement: " thisFlip = evalin( 'base', 'exist(''EEG'',''var'') == 1' );" however this creates an error.

Thanks,
Nick

Does this fix do the job?
(Menu Update > Update Brainstorm, and try again)

https://github.com/brainstorm-tools/brainstorm3/commit/112870905e51ad4b4ed53021662c08d14754494f