Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source localization now require optimization toolbox #2404

Open
arnodelorme opened this issue Apr 8, 2024 · 4 comments
Open

Source localization now require optimization toolbox #2404

arnodelorme opened this issue Apr 8, 2024 · 4 comments

Comments

@arnodelorme
Copy link
Contributor

The source localization code use to work even without the optimization toolbox. Now it generates an error if the toolbox is not present.

load('-mat', 'tmp.mat');
ft_inverse_dipolefit(sourcemodel, sens, headmodel, dat, varargin{:})

Screenshot 2024-04-08 at 3 20 02 PM
tmp.mat.zip

@robertoostenveld
Copy link
Contributor

as far as I know we have not made any relevant changes to this. And both of these work for me with your data:

dip1 = ft_inverse_dipolefit(sourcemodel, sens, headmodel, dat, varargin{:}, 'optimfun', 'fminsearch')
dip2 = ft_inverse_dipolefit(sourcemodel, sens, headmodel, dat, varargin{:}, 'optimfun', 'fminunc')

The optimset that I have on my computer (where I do have the optimization toolbox installed) is /Applications/MATLAB_R2023b.app/toolbox/matlab/optimfun/optimset.m which is not in the optim toolbox. Also according to https://nl.mathworks.com/help/matlab/referencelist.html?type=function&s_tid=hc_panel the optimset function is part of standard MATLAB, not of the optimization toolbox.

I have the suspicion that something is messed up with your path or MATLAB installation.

@arnodelorme
Copy link
Contributor Author

Yes, I removed the optimization toolbox path

rmpath('/Applications/MATLAB_R2024a.app/toolbox/matlab/optimfun/');

Note that this was reported by a user to me that did not have the optimization toolbox and I tried to reproduce it on my machine. The code line 167 to 183 seems to require the optimset function that is only in the optimization toolbox.

@robertoostenveld
Copy link
Contributor

optimset is not only in the optimization toolbox, it is also used for the fminsearch function that is part of the matlab (standard) toolbox

@robertoostenveld
Copy link
Contributor

I believe that the optimization toolbox lives in /Applications/MATLAB_R2023b.app/toolbox/optim. But the organization of the directories is less clear than it was in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants