fetchNext
Retrieve next unread outputs from FevalFuture array.
📝Syntax
[idx, y1, ... , ym] = fetchNext(f)
[idx, y1, ... , ym] = fetchNext(f, timeout)
📥Input Arguments
Parameter Description
f FevalFuture object
timeout timeout seconds: waits for a maximum of timeout seconds for a result in f to become available.
📤Output Arguments
Parameter Description
idx Index of the FevalFuture array, returned as an integer scalar.
y1, ... , ym outputs
📄Description

[idx, y1, ... , ym] = fetchNext(f) retrieves index idx of the new readable FevalFuture object in the array f that is finished, and m results from that FevalFuture as Y1, ... , Ym.

💡Examples
tic()
N = 100;
for idx = N:-1:1
    F(idx) = parfeval(backgroundPool,str2func('rank'),1,magic(idx));
end
results = zeros(1,N);
for idx = 1:N
    [finishedIdx, result] = fetchNext(F);
    results(finishedIdx) = result;
    disp(sprintf('Result: %d', result));
end
toc()
🔗See Also
parfevalfetchOutputsbackgroundPool
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub