fetchOutputs

Retrieve results from function running in the background pool.

Syntax

  • [y1, ... , ym] = fetchOutputs(f)

Input argument

  • f - FevalFuture object

Output argument

  • y1, ... , ym - outputs

Description

[y1, ... , ym] = fetchOutputs(f) retrieves m results from a Future array f.

fetchOutputs waits for the function associated to f to finish before retrieving results.

If fetchOutputs is called, Read property of each element in f is set to true.

Examples

Sequential version

tic()
R1 = magic(5000);
R2 = magic(5000);
toc()
size(R1)

Parallel version

b = backgroundPool()
tic()
fptr = str2func('magic');
f1 = parfeval(b, fptr, 1, 5000);
f2 = parfeval(b, fptr, 1, 5000);
b
r1 = fetchOutputs(f1);
r2 = fetchOutputs(f2);
toc()
size(r1)
f1
f2

See also

parfeval, backgroundPool, fetchNext.

History

VersionDescription

1.0.0

initial version

Author

Allan CORNET

Last updated