Variable in a parfor cannot be classified
Mostrar comentarios más antiguos
I'm attempting to convert some code to use a parfor, and have run into difficulty. A simplified example is given below, which doesn't work. I have read the documentation and lots of answers, but nonetheless can't seem to work it out.
% Preallocate array
var1 = zeros(5);
parfor i = 1:5
for j = 2:6
var1(j, :) = j;
end
end
Preallocating the arrays within the parfor gives no errors, but I don't understand why this works but the initial example doesn't. Could someone please put me out of my misery and explain this, or point me to the right bit of documentation? Thanks
parfor i = 1:5
% Preallocate array
var1 = zeros(5);
for j = 2:6
var1(j, :) = j;
end
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!