fill() in parfor loop

조회 수: 3 (최근 30일)
seb
seb 2012년 4월 18일
I've got ~200,000 polygons to be plotted with fill().
for i=1:size(data,1);
x=data(i,3:2:9);
y=data(i,4:2:10);
f=fill(x,y,data(i,2));
hold on;
end
It works well but takes a bit of time. When I use 'matlabpool open local 4' and change 'for' to 'parfor', I've got no figure output. Any solutions please?
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2012년 4월 18일
Do you actually expect to be able to differentiate 200000 polygons?

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

채택된 답변

Titus Edelhofer
Titus Edelhofer 2012년 4월 18일
Hi,
you should be able to call fill with the corresponding matrices directly, something like
f = fill(data(:, 3:2:9)', data(:, 4:2:10)', data(:,2)');
Titus
  댓글 수: 2
seb
seb 2012년 4월 18일
Many thanks Titus, it's much quicker as run time is 34s:112s! I really shouldn't have abused for loops.
Titus Edelhofer
Titus Edelhofer 2012년 4월 19일
Hi Seb, your welcome. You might mark the question then as answered, if you think it is ...

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

추가 답변 (1개)

Edric Ellis
Edric Ellis 2012년 4월 18일
Unfortunately, you cannot use a PARFOR loop in this way. The workers cannot create graphics on your client.
  댓글 수: 1
seb
seb 2012년 4월 18일
Many thanks Edric. Still wondering if there's any other way to speedup this tedious job, without parfor.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by