hasdata
Determine if data is available to read from datastore
Syntax
Description
Examples
Determine Pixel Data Available to Read
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
ds
— Datastore with labeled data
PixelLabelDatastore
object | pixelLabelImageDatastore
object | boxLabelDatastore
object
Datastore with labeled data for training a semantic segmentation network
or an object detection network, specified as a pixelLabelDatastore
, pixelLabelImageDatastore
, or boxLabelDatastore
object.
Output Arguments
tf
— Datastore data status
1
| 0
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
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)