MATLAB: Undefined function ‘twofunc’ for input arguments of type ‘double’

Optimization Toolbox

while calculation optimization problem by using genetic alorith solver in optimization tool , "it says Undefined function 'twofunc' for input arguments of type 'double'", what does it mean?

Best Answer

Your code calls a function named twofunc but your code does not define twofunc.
Another possibility is that you used a variable named twofunc before you assigned a value to it.
There is no Mathworks supplied function named twofunc anywhere in any toolbox.