Why do I get an error when I try to use optimization functions from base MATLAB 7.14 (R2012a)?

조회 수: 42 (최근 30일)
When I try to use any of the optimization functions from base MATLAB 7.14 (R2012a) I get either of the following errors depending on the function used:
Undefined function 'optimset' for input arguments of type 'char'.
Undefined function 'optimset' for input arguments of type 'struct'.
Undefined function 'fzero' for input arguments of type 'function_handle'.
Undefined function 'fminbnd' for input arguments of type 'function_handle'.
Undefined function 'fminsearch' for input arguments of type 'function_handle'.
Undefined function 'lsqnonneg' for input arguments of type 'function_handle'.
These error messages are seen primarily just after migration from a previous version of MATLAB due to a path issue.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2012년 7월 26일
In MATLAB 7.14 (R2012a) the base MATLAB optimization related functions were moved from the following location
>> [matlabroot '\toolbox\matlab\funfun\']
to
>> [matlabroot '\toolbox\matlab\optimfun\']
Since MATLAB copies all the preferences from the previous release to the new preference directory the issue is caused because MATLAB is unable to find these function.
The fix for this issue is to execute the following commands so that the path is restored to default and the toolbox cache is updated:
>> restoredefaultpath
>> rehash toolboxcache
Since restoring the default path will remove any personal path changes, you can manually fix this by navigating to:
cd(matlabroot);
cd toolbox;
cd matlab;
addpath(genpath('optimfun'));
savepath;
rehash;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

제품


릴리스

R2012a

Community Treasure Hunt

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

Start Hunting!

Translated by