Specify a function to invoke after each parallel.Future completes
automatically
evaluates outputFuture
= afterEach(futures
,funtocall
,nout
) funtocall
on the output arguments of each of the
elements in futures
as they become ready.
afterEach
calls funtocall
with
nout
output arguments and produces
outputFuture
to hold the outputs.
A useful application for afterEach
is to update user
interfaces such as plots and apps during parallel computations using parfeval
. For example, you can
send several computations to workers using parfeval
and update your user
interface when each of those finishes using afterEach
.
behaves the same if outputFuture
= afterEach(futures
,funtocall
,nout
,'PassFuture',passFuture
)passFuture
is false
. If
passFuture
is true
,
afterEach
invokes funtocall
on each
element in futures
, and not on their output arguments. This
happens even if elements of futures
encountered errors.
Use afterEach
on any of the futures returned from
parfeval
, parfevalOnAll
, afterAll
, afterEach,
or an array containing
a combination of them. For example, use afterEach
to
automatically invoke more functions on the results of another afterAll
or afterEach
. You can invoke
afterEach
on futures before and after they
finish.
Use cancel
on a future returned
from afterEach
to cancel its execution. If you invoke
afterEach
on a canceled future,
afterEach
behaves the same way as if the future had an
error.