hasdata - Determine if data is available to read - MATLAB (original) (raw)
Main Content
Determine if data is available to read
Syntax
Description
tf = hasdata([ds](#bueftqx-1-ds))
returns logical1
(true
) if there is data available to read from the datastore specified by ds
. Otherwise, it returns logical 0
(false
).
Examples
Create a datastore from the sample file, mapredout.mat
, which is the output file of the mapreduce
function.
ds = datastore('mapredout.mat');
While there is data available in the datastore, read the data.
while hasdata(ds) T = read(ds); end
Input Arguments
Extended Capabilities
Usage notes and limitations:
- In a thread-based environment, you can use
hasdata
only with the following datastores:ImageDatastore
objectsCombinedDatastore
,SequentialDatastore
, orTransformedDatastore
objects you create fromImageDatastore
objects by usingcombine
ortransform
You can usehasdata
with other datastores if you have Parallel Computing Toolbox™. To do so, run the function using a process-backed parallel pool instead of usingbackgroundPool
orThreadPool
(use eitherProcessPool
orClusterPool
).
For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2014b