I have a for
loop in a curve fitting problem that needs to be parallelized using the parfor
loop. Below is the for
loop that works in single core, is there a way I can convert this to parfor
?
for initial_p = [1:1:1000]
% initial condition for fitting
x0 = [50 5 10 50 5];
% run the solver
options = optimset('MaxFunEvals',10000,'MaxIter',10000,'Display','iter');
[x,fval,exitflag,output] = fminsearch(@(x) Obj(x,initial_p,c1,c2,c3,c4,c5,c6,t,y),x0,options);
% exit for loop
if x(1) < 100
break
end
end