The variable in parfor cant classified

조회 수: 1 (최근 30일)
htrh5
htrh5 2015년 7월 11일
댓글: htrh5 2015년 7월 12일
parpool(3)
parfor n = 1:N
a=n/60;
for u_p=1:length(t)
x_a(n,u_p)=sqrt(1-1i*cot(a*pi/2)) *integral(@(u) ...
rectpuls(u).*exp(1i*pi* ( cot(a*pi/2)*t(u_p)^2 -2*csc(a*pi/2)*u*t(u_p) +cot(a*pi/2)*u.^2 )) ,- HalfDur,HalfDur );
end
end
Pretty sure I do not access the same location, but I might be wrong. What am I doing wrong?
on a side note, how can I write that inner loop better? i couldnt vector it

채택된 답변

Walter Roberson
Walter Roberson 2015년 7월 12일
parfor requires that it be obvious that the same location cannot be written to multiple times.
You should write your output to a vector indexed just by n. You can then reshape the vector afterwards.
  댓글 수: 5
Walter Roberson
Walter Roberson 2015년 7월 12일
Consider using the ArrayValued option of integral()
htrh5
htrh5 2015년 7월 12일
Thanks, that's it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by