The cause of the error related to statistical functions when using EEGLAB

Installation of eeglab2023.0 renders certain statistical functions in MATLAB, such as ttest2, unusable.
Can you please provide a solution to this issue?

 Accepted Answer

I have this problem with Eigenvector's PLS toolbox. There are several functions (skewness, dataset, etc.) that they claim they wrote before functions of the same name were introduced by Mathworks and they refuse to change them. If you know you will always want the MATLAB version and never want the EEGLAB version of the function, then you can move the EEGLAB paths down below the toolbox paths. Use the SetPath button on the Home tab of the toolribbon to move the paths down.
If sometimes you want EEGLAB functions and sometimes the MATLAB versions of those functions then you can rename the EEGLAB functions and call them in your code by the new name instead of the original EEGLAB function name. Like preface the shadowed functions with "eeg" or something.

8 Comments

Thank you for your response. It's possible that even if you move the path down or rename the function, you may still encounter errors.
Even after renaming the 'ttest2' function used in eeglab to 'eeg_ttest2', it still cannot be executed.
Even after renaming the 'ttest2' function used in eeglab to 'eeg_ttest2', it still cannot be executed.
There might be additional functions in the package that have to be renamed this way.
I’m sorry for the late reply.
'ttest2' refers to this path.
>> which -all ttest2
C:\Program Files\MATLAB\R2019a\toolbox\stats\stats\ttest2.m
After launching 'eeglab', the error message 'ttest2 not found.' is displayed.
I would tell that to the eeglab authors. The built-in ttest2 is clearly on the path before eeglab launches but no longer on the path once eeglab launches. Perhaps they had to remove the path to the stats toolbox for some reason. With eeglab up and running, can you do
>> which -all ttest2
again to see if it's still on the path once eeglab has launched?
Thanks!
I can't use statistical functions such as `ttest2' after running EEGLAB.
Path before starting EEGLAB
which -all ttest2
C:¥Program Files¥MATLAB¥R2019a¥toolbox¥stats¥stats¥ttest2.m
Path after starting EEGLAB
'ttest2' is not found.
EEGLab is changing the path for some reason. You can either search the source code for strings like "rmpath", "path", "savepath", "addpath", etc. Or you can contact the publisher and ask why their program removes the stats toolbox from the path.
Thank you for your response.
I will contact publisher .

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2019a

Asked:

on 26 Apr 2023

Commented:

on 12 May 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!