From: Edric M Ellis on
"Carlos R del Blanco" <cda(a)gti.ssr.upm.es> writes:

> Oh, sorry, there was an error, I wanted to say "so it can NOT be seen
> by any Matlab worker", so of course I agree with you. The question is:
> can I transfer the graphic object to the worker in order to print it?
> or, since the workers have not graphics capabilities, does it imply
> that is totally impossible?

You can transfer the *data* that you wish to plot to the workers, have
them create the plot (even though they do not have a display - they
still know how to do all the work off-screen), and then do the
print/saveas. For example:


matlabpool local 3
imdata = imread( 'ngc6543a.jpg' ); % sample image which comes with MATLAB

parfor ii=1:3
imagesc( imdata( :, :, ii ) );
fname = sprintf( 'page_%d.jpg', ii );
print( '-djpeg90', fname );
end

Cheers,

Edric.
From: Carlos R del Blanco on
Thank you very much. Only one additional remark: using imshow() instead of imagesc() doesn't work, it gives an error related to java:

??? Error using ==> parallel_function at 598
Error in ==> imshow at 191
IMSHOW requires Java to run.

My hypothesis that the worker have some restrictions with the Java Run Time environtment.


Edric M Ellis <eellis(a)mathworks.com> wrote in message <ytwsk3t53ti.fsf(a)uk-eellis-deb5-64.mathworks.co.uk>...
> "Carlos R del Blanco" <cda(a)gti.ssr.upm.es> writes:
>
> > Oh, sorry, there was an error, I wanted to say "so it can NOT be seen
> > by any Matlab worker", so of course I agree with you. The question is:
> > can I transfer the graphic object to the worker in order to print it?
> > or, since the workers have not graphics capabilities, does it imply
> > that is totally impossible?
>
> You can transfer the *data* that you wish to plot to the workers, have
> them create the plot (even though they do not have a display - they
> still know how to do all the work off-screen), and then do the
> print/saveas. For example:
>
>
> matlabpool local 3
> imdata = imread( 'ngc6543a.jpg' ); % sample image which comes with MATLAB
>
> parfor ii=1:3
> imagesc( imdata( :, :, ii ) );
> fname = sprintf( 'page_%d.jpg', ii );
> print( '-djpeg90', fname );
> end
>
> Cheers,
>
> Edric.