Future
Function scheduled to run
Description
A Future
object represents a function that you schedule to run in
MATLAB®.
If you use
parfeval
orparfevalOnAll
to create aFuture
, MATLAB runs the function:In the background, if you specify
backgroundPool
when creating theFuture
.On a parallel pool, if you do not specify
backgroundPool
when creating theFuture
, have Parallel Computing Toolbox™ and one of the following applies:You have a parallel pool currently open.
You have automatic pool creation enabled.
In serial, otherwise.
If you use
afterEach
orafterAll
to create aFuture
, the function is run by your current MATLAB session. It is not run in the background or on any parallel pool.
Creation
You create a Future
object when you do one of the following:
Use
parfeval
to schedule a function to run in the background, on a parallel pool, or in serial.Use
parfevalOnAll
to schedule a function to run on all workers in a pool, or in serial.Use
afterEach
orafterAll
to schedule a function to run afterFuture
objects finish.
The available types of future objects follow.
Future Object | Description |
---|---|
FevalFuture | Created by parfeval |
FevalOnAllFuture | Created by parfevalOnAll |
AfterEachFuture | Created by afterEach |
AfterAllFuture | Created by afterAll |
Properties
Object Functions
Examples
Tips
Future
objects are local objects and can be accessed only in the MATLAB session that created them.For example, if you use
parfeval
to run a function in the background and create aFuture
object, theFuture
is not available in the workspace of background workers.
Extended Capabilities
Version History
Introduced in R2013b
See Also
parallel.Pool
(Parallel Computing Toolbox) | parfeval
(Parallel Computing Toolbox) | parfevalOnAll
(Parallel Computing Toolbox) | afterAll
| afterEach