poll
Retrieve data from PollableDataQueue
Description
retrieves
one item of data from the data = poll(q)PollableDataQueue object q.
Send data from the background or your current MATLAB® session using send.
You can retrieve data sent from a function that you run on a parallel pool if you have
Parallel Computing Toolbox™. For details, see poll (Parallel Computing Toolbox).
If no data is in the queue,
pollreturns[].If data is in the queue,
pollreturns the oldest item of data in the queue, even if the queue is closed.If the queue is closed and no data is in the queue,
pollreturns[].
waits data = poll(q,timeout)timeout seconds to retrieve an item of data from the
PollableDataQueue object q.
If data is in the queue,
pollreturns the oldest item of data in the queue, even if the queue is closed.If no data is in the queue,
pollwaits up totimeoutseconds. If the queue receives data beforetimeoutseconds elapse,pollreturns that item. If no data is received in the queue beforetimeoutseconds elapse,pollreturns[].If the queue is closed or is closed during timeout and no data is in the queue,
polldoes not wait and returns[].
[ tries to retrieve data from a queue and returns a flag
data,tf]
= poll(___)tf. If poll returns data,
tf is true. Otherwise, tf is
false.
You can use this syntax with any of the input argument combinations in the previous
syntaxes. For example, [data,tf] = poll(q,5) waits to retrieve data from
the queue q for five seconds.
Examples
Input Arguments
Output Arguments
Extended Capabilities
Version History
Introduced in R2017a
See Also
afterEach | send | close | parfor | parallel.pool.DataQueue | parallel.pool.PollableDataQueue