Main Content

hasdata

Determine if data is available to read from label datastore

Description

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).

example

Examples

collapse all

Check if pixel label data can be read from a datastore.

Set the location of the image and pixel label data.

dataDir = fullfile(toolboxdir('vision'),'visiondata');
imDir = fullfile(dataDir,'building');
pxDir = fullfile(dataDir,'buildingPixelLabels');

Create an image and pixel label datastore.

imds = imageDatastore(imDir);
classNames = ["sky" "grass" "building" "sidewalk"];
pixelLabelID = [1 2 3 4];
pxds = pixelLabelDatastore(pxDir,classNames,pixelLabelID);

While data is available in the datastore, read the data.

while hasdata(pxds)
    T = read(pxds);
end

Input Arguments

collapse all

Datastore with labeled data for training a semantic segmentation network or an object detection network, specified as a pixelLabelDatastore or boxLabelDatastore object.

Output Arguments

collapse all

Datastore data status, returned as a logical 1 (true) if there is data available to read from the datastore specified by ds. Otherwise, it returns logical 0 (false).

Version History

Introduced in R2017b

See Also

(Deep Learning Toolbox) | |