Why ParFor does not work for this?

3 visualizaciones (últimos 30 días)
Erdem Uguz
Erdem Uguz el 27 de Dic. de 2017
Respondida: Namnendra el 19 de Jun. de 2022
It is a really simple manipulation. I want to replace some lines of the matrix with zeros.
A=rand(20,20);
for j=1:1:4
A(4*j+1,:)=zeros;
end
When I replace for with parfor I get a classification error. But the results of the manipulation is independent from each other. I don't understand why.
Thank you Erdem

Respuestas (1)

Namnendra
Namnendra el 19 de Jun. de 2022
All variables referenced at the top level of the parfor must be resolved and classified. Go through the following link to know more :-
You can try putting the body of perfor loop into a function and calling the function from the loop.
I hope this helps.

Categorías

Más información sobre Parallel for-Loops (parfor) en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by