Dear All,
I'm trying to use parallel workers in an optimization problem but I cannot define X and Y as sliced variables. X contains the population, Y contains the fitness values. As the error message says: variable X & Y in a parfor cannot be classified.
First I define X, (it has to be outside the parfor loop otherwise I get new X-es in every single loop); than parfor follows:
parfor t=1:T TmpZ=Func(Z(1,:));TmpX=Func(X(t,:)); if TmpZ < TmpX X(t,:)=Z(1,:); Y(t,1)=TmpZ; else X(t,:)=X(t,:); Y(t,1)=TmpX; endend
Thanks
Best Answer