Clear Filters
Clear Filters

I have error codes when which I am unsure how to fix

27 views (last 30 days)
This is the what the command window is saying after I try to run my code:
fminunc requires Optimization Toolbox.
Error in runMe (line 65)
fminunc(@(t)(costFunctionReg(t, X, y, lambda)), initial_theta, options);
Error in run (line 99)
evalin('caller', strcat(script, ';'));
  2 Comments
Dyuman Joshi
Dyuman Joshi on 19 Dec 2023
[status,errmsg] = license('checkout','Optimization_Toolbox')
Run this code and see if you have the Optimization Toolbox licensed or not.
If status is 1, you have it licensed and download and install the toolbox from the Add-ons.
If status is 0, you will need to purchase the toolbox.

Sign in to comment.

Answers (1)

Gagan Agarwal
Gagan Agarwal on 15 Jan 2024
Edited: Gagan Agarwal on 15 Jan 2024
Hi Danny,
It seems that you are encountering the above error code because of the absence of the 'Optimization ToolBox'. You can verify if you have the license for the same or not by using the following command:
a = license('test','Optimization_Toolbox')
% a = 1 denotes that you have the license of the toolbox therefore you have to
% install it from the Add-ons.
% a = 0 denotes the absence of license of the toolbox therefore you have to purchase it
% for the Optimization_Toolbox
You can also verify if the toolbox is installed or not by using the following command:
v = ver;
a = any(strcmp('Optimization Toolbox', {v.Name}))
% a = 1 denotes that the toolbox is installed but since it is showing the error therefore
% you should try reinstalling it from the Add-ons.
% a = 0 denotes that the toolbox is not installed therefore you should
% install it from the Add-ons.
I hope it helps!

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!