Determine if data is available to read
tf = hasdata(ds)
example
tf = hasdata(ds) returns logical 1 (true) if there is data available to read from the datastore specified by ds. Otherwise, it returns logical 0 (false).
ds
1
true
0
false
collapse all
Create a datastore from the sample file, mapredout.mat, which is the output file of the mapreduce function.
mapredout.mat
mapreduce
ds = datastore('mapredout.mat');
While there is data available in the datastore, read the data.
while hasdata(ds) T = read(ds); end
Input datastore. You can use these datastores as input to the hasdata method.
hasdata
MATLAB® datastores — Datastores created using MATLAB datastore functions. For example, create a datastore for a collection of images using ImageDatastore. For a complete list of datastores, see Select Datastore for File Format or Application.
datastore
ImageDatastore
Combined or transformed datastores — Datastores created using the combine and transform functions.
combine
transform
Custom datastores — Datastores created using the custom datastore framework. See Develop Custom Datastore.
You have a modified version of this example. Do you want to open this example with your edits?