fetchOutputs (FevalFuture)

Retrieve all output arguments from Future

Syntax

[B1,B2,...,Bn] = fetchOutputs(F)
[B1,B2,...,Bn] = fetchOutputs(F,'UniformOutput',false)

Description

[B1,B2,...,Bn] = fetchOutputs(F) fetches all outputs of future object F after first waiting for each element of F to reach the state 'finished'. An error results if any element of F has NumOutputArguments less than the requested number of outputs.

When F is a vector of FevalFutures, each output argument is formed by concatenating the corresponding output arguments from each future in F. An error results if these outputs cannot be concatenated. To avoid this error, set the 'UniformOutput' option to false.

[B1,B2,...,Bn] = fetchOutputs(F,'UniformOutput',false) requests that fetchOutputs combine the future outputs into cell arrays B1,B2,...,Bn. The outputs of F can be of any size or type.

After the call to fetchOutputs, all futures in F have their 'Read' property set to true. fetchOutputs returns outputs for all futures in F regardless of the value of each future’s 'Read' property.

Examples

Create an FevalFuture, and fetch its outputs.

f = parfeval(@rand,1,3);
R = fetchOutputs(f)
0.5562    0.6218    0.3897
0.0084    0.4399    0.2700
0.0048    0.9658    0.8488

Create an FevalFuture vector, and fetch all its outputs.

for idx = 1:10
    F(idx) = parfeval(@rand,1,1,10); % One row each future
end
R = fetchOutputs(F); % 10-by-10 concatenated output

Introduced in R2013b

Was this topic helpful?