How is parfor time taken is larger than that by normal for loop ?
조회 수: 1 (최근 30일)
이전 댓글 표시
The time taken (t1) by parfor is larger than that (t2) by the normal for loop,I don't understand why ?
댓글 수: 0
답변 (1개)
Sindar
2020년 7월 17일
Best guess: you don't preallocate y, nor clear it. So, the parfor needs to expand the vector constantly while the for is simply overwriting elements. Try
x=1:4000;
y1=false(size(x));
y2=false(size(x));
...
y1(i)=
...
y2(i)=
댓글 수: 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!