GEDAI Failed: Size arguments must be real integers

Hi Brainstorm team,

I am using the GEDAI plugin on simultaneous EEG-fMRI data recorded with a BrainVision amplifier and imported from .vhdr / .vmrk / .eeg files.

My environment is MATLAB R2023b and Brainstorm 16-Feb-2026. The recording has 32 channels total, including 1 ECG channel, and GEDAI reports “GEDAI denoising of EEG : 31 channels”.

GEDAI starts, but then fails with the following error:

GEDAI Leadfield model: BEM precomputed for EEG
Attempting GPU processing (Double Precision)...

SENSAI threshold detection...please wait

Excluding 0 wavelet bands with upper frequency < 0.5 Hz.
processing wavelet band = 1
Executing Last Resort: Single Precision Non-Parallel Processing...
Error using reshape
Size arguments must be real integers.

Error in GEDAI_per_band (line 56)
EEGdata_epoched = reshape(eeg_data, N_EEG_electrodes, epoch_samples, []);

The Brainstorm error is:

Error: [process_gedai] Artifacts > GEDAI
GEDAI Failed: Size arguments must be real integers.
File: Subject03/@rawBA0035/data_0raw_BA0035.mat

Is this a known limitation of GEDAI with simultaneous EEG-fMRI BrainVision raw data, or should epoch_samples be converted to an integer before reshape in GEDAI_per_band?

Also, for this type of dataset, should I use interpolated leadfield matrix instead of BEM precomputed for EEG?

Thanks,

Hi @prazmara, this indeed seems a problem in how the data is treated inside the GEDAI code.

FYI: @tomasros

Hi Prazmara,

There should be no problem with attempting to denoise simultaneous EEG-fMRI data. The problem seem to stem from floating-point (in)accuracy in setting the epoch size, particularly if the sampling rate of the file is not a clean integer (e.g., 1000.4 Hz or 4999.98 Hz), which may occur after downsampling etc.

I have now implemented a fix ensuring that any tiny precision error in the sampling rate (like the result being 250.00000000000003) is rounded back to the exact integer 250 before being passed to reshape.

Let me know if that fixes the problem.

Cheers and thanks for flagging it up,
Tomas