matlab - Matlabpool causes some problems with surf() function -


i encountered problem using parfor in matlab. run code below inside function called within parfor loop:

  • if open matlabpool, program crash on saveas function;
  • if not open matlabpool, works well;
  • if comment both surf calls, again works well, matlabpool open.

i saveas .pdf format if saveas .fig format works well. .fig format format not cause problems. of course, cannot debug parallel loop because parfor matlabpool open not allow step into, therefore without matlabpool open can see every variable good.

am missing something? cannot find known problem using surf within parfor loop. there many strange issues try understand true problem, ask if has had similar problem.

threads=4;  matlabpool(threads);  parfor i=1:threads     t=getcurrenttask();     tmppath=['tmp' num2str(t.id)];     importadata = open([tmppath '\' 'title','.mat']);     if isempty(importadata) == 0         f8 = importadata.data; %clear importadata;          hf8 = figure('name','title','numbertitle','off', 'color',[1 1 1], 'visible', 'off');          hold on; grid on; subplot(f8.subplot1);         title('title');         h = surf(f8.x1,f8.y1,f8.surfval1); set(h, 'edgealpha', 0.05); axis('square'); view(0,90);         xlabel(f8.xlabel1); ylabel(f8.ylabel1); zlabel(f8.zlabel1);         hold on; subplot(f8.subplot2);         h = surf(f8.x2,f8.y2,f8.surfval2); set(h, 'edgealpha', 0.05); axis('square'); view(0,90);         xlabel(f8.xlabel2); ylabel(f8.ylabel2); zlabel(f8.zlabel2);          cd(tmppath);         saveas(hf8, 'title', 'pdf'); close(hf8);         cd('..');         delete([tmppath '\' 'title','.mat']);     else         error = -1;             end; end; 

up: ok, finished program lead error:

error using distcomp.remoteparfor/getcompleteintervals (line 22) session parfor using has shut down.

my goal save title.mat pdf file. of course title.mat contains consistent , correct data. every thread should go exclusive directory contains .mat file translate. if not open pool, works expected. if save in .fig format, works expected.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -