Retrieve next unread outputs fromFuture
array
[
retrieves the linear indexidx
,Y1,...,Ym
] = fetchNext(F
)idx
of the next unreadFuture
object in the arrayF
that is finished, andm
results from thatFuture
asY1,...,Ym
.
You can only usefetchNext
withFuture
objects you create usingparfeval
.
AFuture
is unread if itsRead
property isfalse
. IfF
has no unread elements, MATLAB®throws an error.
AFuture
is finished if itsState
property is'finished'
. If no unread elements are in the'finished'
state, MATLAB first waits for an element ofF
to finish.
fetchNext
reads elements fromF
in order of completion. AfterfetchNext
retrieves the outputs from the next unreadFuture
object in the arrayF
, MATLAB sets theRead
property of thatFuture
totrue
.
IffetchNext
reads an element fromF
that encounters an error, the function first sets theRead
property of theFuture
element to true. Then,fetchNext
throws an error.