for X=1:1:10 for Y=1:1:10 ObjFcn = @myObjective; x0 = [10 0.001 7]; LB = [0 0 0]; UB = [50 0.5 7.5]; ConsFcn = @(x)myConstraints(x,X,Y); [x] = fmincon(ObjFcn,x0,[],[],[],[],LB,UB,ConsFcn); disp(x) disp(myObjective(x)) end end
MATLAB: For each fmincon it overwrites the previous values, meaning at the end there is only 1 set of values when there should be 100. The code is running 100 times and displays all sets of values but not storing all sets. How to resolve this
arrayforloopoptimizationstoring
Best Answer