Main Content

hasdata

Determine if data is available to read from datastore

Description

example

tf= hasdata(ds)returns logical1(true) if there is data available to read from the datastore specified byds. Otherwise, it returns logical0(false).

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.

whilehasdata(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 apixelLabelDatastore,pixelLabelImageDatastore, orboxLabelDatastoreobject.

Output Arguments

collapse all

Datastore data status, returned as a logical1(true) if there is data available to read from the datastore specified byds. Otherwise, it returns logical0(false).

版本;n History

Introduced in R2017b