My functions look like that:
function area_rectangle = area_rectangle(input_variables) if ~isfield(input_variables,'height') || ~isfield(input_variables,'width') area_rectangle = NaN; else area_rectangle = input_variables.width * input_variables.height; end
Suppose I want to use one of Matlabs optimization methods, e.g. fmincon, and pass a struct as input. How could I do that?
fmincon(@area_rectangle, input_variables, ...)Error using fmincon (line 224)FMINCON requires the following inputs to be of data type double: 'X0'.
Thanks in advance! Carolin
Best Answer