Source localization with wMEM

Hi,
I'm trying to compute source localization of high frequency oscillations with wMEM. But errors occur:

The index exceeds the matrix dimension.

Error process_inverse_2018>Compute (line 667)
OPTIONS.Data = DataMat.F(GoodChannel,:);

Error process_inverse_2018 (line 24)
eval(macro_method);

Error panel_protocols>TreeInverse (line 1316)
[OutputFiles, errMessage] = process_inverse_2018('Compute', iStudies, iDatas);

Error panel_protocols (line 44)
eval(macro_method);

Error tree_callbacks>@(h,ev)panel_protocols('TreeInverse',bstNodes,'2018') (line 2528)
gui_component('MenuItem', jPopup, , 'Compute sources [2018]',
IconLoader.ICON_RESULTS, , @(h,ev)panel_protocols('TreeInverse', bstNodes, '2018'));

Could you help me solve the problem? And what does it mean by "Not enough in SAM" when set "Oscillations Options"? Thanks

This is a question for the MEM developers:
@youneszer @klack @RChowdhury @tanguy @Lina @cgrova @aliobaibk?

Hello @iris3399

Could you check if the input data has a correct time definition (for example from the time panel when displaying the recording).
There seems to be a problem with the input as the toolbox cannot read the time definition (there should not be some "NaN" in [Time window]).

Else, at least 128 time samples are needed to run wMEM (the message "NOT ENOUGH SAMPLES" is otherwise displayed).

Thanks for your reply. I have checked the time definition of input data, but nothing special has been found. The high frequency oscillations (HFOs) were automatically extracted from EEG data. When I try to compute the source of HFOs with wMEM again, new errors occur:

Incorrect use of randi
The first input must be a positive scalar integer value IMAX,or two integer values [IMIN IMAX] (IMIN is less than or equal to IMAX).

Error be_msp_h0beta_fit (line 55)
n_win = unique(randi(size(M,2)-NW-1,1,3*NSAMP));

Error be_model_of_null_hypothesis (line 50)
[param, OPTIONS] = be_msp_h0beta_fit(BSL, OPTIONS.automatic.Modality(ii).gain_struct, OPTIONS);

Error be_wmem_solver (line 142)
OPTIONS = be_model_of_null_hypothesis(OPTIONS);

Error be_main_call (line 148)
[Results, MEMoptions] = feval(['be_' lower(MEMoptions.mandatory.pipeline) '_solver'], HeadModel, MEMoptions, Results
);

Error be_main (line 60)
[Results, OPTIONS] = be_main_call(varargin{:});

Error process_inverse_2018>Compute (line 674)
[Results, OPTIONS] = be_main(HeadModel, OPTIONS);

Error process_inverse_2018 (line 24)
eval(macro_method);

Error panel_protocols>TreeInverse (line 1316)
[OutputFiles, errMessage] = process_inverse_2018('Compute', iStudies, iDatas);

Error panel_protocols (line 44)
eval(macro_method);

Error tree_callbacks>@(h,ev)panel_protocols('TreeInverse',bstNodes,'2018') (line 2528)
gui_component('MenuItem', jPopup, , 'Compute sources [2018]', IconLoader.ICON_RESULTS, ,
@(h,ev)panel_protocols('TreeInverse', bstNodes, '2018'));

BST> Saving protocol "Protocol02"...

Could you help me solve the problem? The parameters are showed in the screenshot. Thanks.

Hello @iris3399

This error means that your baseline window is too short.
Here I read [0, 0.005] s, what is the sampling frequency?
You will need at least 12 time samples with the default options.

@aliobaibk Thanks. According to your reply, the problem has been solved.