Clear Filters
Clear Filters

How to distinctly assign job and get the result of each worker using "parfor"?

4 views (last 30 days)
I'm using parallel computing toolbox in order to parallelize my computation. there is a need for assigning an identical job with different data to each worker and after the computation of workers is done, I need to distinctly get each woker's result in the client process and use each of them for another purpose. how can I do this?!

Accepted Answer

Edric Ellis
Edric Ellis on 7 May 2020
This sounds more like a job for spmd . Read more about that here: . Here's an extremely simple example:
myOutput = 2 * labindex; % labindex has a different value on each worker
myOutput{3} % gets the value from the 3rd worker
Bill Masters
Bill Masters on 7 May 2020
suppose that I have 4 workers and 4 input data as well,
conceptually I need the work be done as below, but I don't know how to organize it:
%func is a function defined before, to be done seperately
% by each worker with their own data in parallel

Sign in to comment.

More Answers (0)


Find more on MATLAB Parallel Server in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!