Borrar filtros
Borrar filtros

parfor indexing and order

2 visualizaciones (últimos 30 días)
xplore29
xplore29 el 3 de Abr. de 2013
[a,b,c]=size(Mask); % a=b=c=3;
parfor i=1:size(Mask,3)
i
end
I was expecting to see i=1,i=2,i=3 in a sequence as one would see in a for loop but it is giving me i=3,i=2,i=1 . This is in reverse order. I cant figure out the reason.

Respuesta aceptada

xplore29
xplore29 el 4 de Abr. de 2013
Although I am not using parfor for variable display purpose but I am curious to know that if I try to display the variable like this in parfor the order will always be reverse (like in my example) or it can be random.

Más respuestas (1)

Edric Ellis
Edric Ellis el 4 de Abr. de 2013
PARFOR loops can run in parallel, and as such, the iterations might run in any order. You should not rely on this order. In particular, as you have observed, PARFOR starts running iterations in reverse order.

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