Why am I getting this error??!! #fmincon
Show older comments
I am getting the following error in my MATLAB code. I have already checked i hvae these functions on my computer.
Check for missing argument or incorrect argument data type in call to function 'classifyBoundsOnVars'.
Error in fmincon (line 525)
xIndices = classifyBoundsOnVars(l,u,sizes.nVar,true);
Error in optm (line 7)
[x,fval] = fmincon(@optmequation,x0,[],[],[],[],[],[],@constraint,options)
4 Comments
Athul Prakash
on 3 Apr 2020
Could you provide more details so that the community can have a look at your variables? How are you creating 'optmequation', 'constraint' and what is your options struct?
hapa_kazi_tu
on 2 Jun 2020
I am receiving the same error message, using the latest version of MATLAB and the optimization toolbox.
Here is a short example that leads to the error: (from the documentation of fmincon)
fun = @(x) 100*(x(2)-x(1)^2)^2 + (1-x(1))^2;
x0 = [-1,2];
A = [1,2];
b = 1;
x = fmincon(fun,x0,A,b)
This is the result:
Check for missing argument or incorrect
argument data type in call to function
'classifyBoundsOnVars'.
Error in fmincon (line 525)
xIndices =
classifyBoundsOnVars(l,u,sizes.nVar,true);
Error in example (line 6)
x = fmincon(fun,x0,A,b)
hapa_kazi_tu
on 2 Jun 2020
I solved it by myself :) For some reason there was a copy of fmincon.m in the same folder as the script, and this version seemed to be out of date.
AquilesC
on 2 Jul 2021
Yep hapa_kazi_tu, your comment is correct !!!, don´t put any copy of fmincon.m in the same folder where the script is. I have had the same problem as you.
Answers (1)
Steve Grikschat
on 6 Jul 2021
This is likely due to an installation issue.
fmincon is part of Optimization Toolbox, and if you do not have the full installation, fmincon will be there but other internal functions (like classifyBoundsOnVars) may not.
Try calling
which -all classifyBoundsOnVars
If it is not there, then you need to (re-)install Optimization Toolbox.
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!