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.
parfor indexing and order
조회 수: 4 (최근 30일)
이전 댓글 표시
[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.
댓글 수: 0
채택된 답변
추가 답변 (1개)
Edric Ellis
2013년 4월 4일
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!