The variable in parfor cant classified

2 Ansichten (letzte 30 Tage)
htrh5
htrh5 am 11 Jul. 2015
Kommentiert: htrh5 am 12 Jul. 2015
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 12 Jul. 2015
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 Kommentare
Walter Roberson
Walter Roberson am 12 Jul. 2015
Consider using the ArrayValued option of integral()
htrh5
htrh5 am 12 Jul. 2015
Thanks, that's it.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Parallel Computing Fundamentals finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by