フィルターのクリア

How do I plot a temporary variable in a parfor loop?

2 ビュー (過去 30 日間)
Guy Nir
Guy Nir 2016 年 12 月 9 日
編集済み: kira 2022 年 1 月 27 日
Hi,
I'm trying to make a surf plot with a parfor loop:
figure();
hold on
view(3)
[x,y,z]=sphere;
h=waitbar(0,'Please wait, generating figure');
for i=1:N
for r=linspace(.1,15,40) % sphere radius
clr=colormap(jet(N_unique));
h=surf(XFoci(i) + r*x,YFoci(i) + r*y,ZFoci(i) + r*z,'facecolor',clr(ic(i),:),'edgecolor','none');
alpha(h,(1./(r+1)));
end % for r=linspace(.1,10,40) % sphere radius
end % for i=1:N
Other than the fact that I have to change r to be integer numbers (no problems), I'm not sure how to parallelize the surf ploting using parfor.
Thanks, Guy

採用された回答

Edric Ellis
Edric Ellis 2016 年 12 月 12 日
Unfortunately, parallel pool workers are separate MATLAB processes, and they cannot access the same figure handles that your desktop MATLAB client creates. Workers can create graphics, but each worker does so independently, so you cannot have multiple workers collaborate on a figure. After a worker has produced graphical output, the next step is to use print to output it to a file - workers cannot display graphics on-screen.
  1 件のコメント
Guy Nir
Guy Nir 2016 年 12 月 12 日
Thanks Edric, but I am interested in printing 1 figure which is the output of all workers. I did however created a cell array of spheres in parallel, and then plot the cell array with surf not in parallel.

サインインしてコメントする。

その他の回答 (1 件)

kira
kira 2022 年 1 月 27 日
編集済み: kira 2022 年 1 月 27 日
Hi,
maybe what it is decribed here can help you.
Regards,

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by