hasdata - Determine if data is available to read from label datastore - MATLAB (original) (raw)
Main Content
Determine if data is available to read from label datastore
Syntax
Description
[tf](#mw%5Fa667a22a-9c7d-4aec-82d6-22e99dc8ff2b) = hasdata([ds](#mw%5F7356c377-2e20-40af-b6cb-18861356e61c))
returns logical 1
(true
) if there is data available to read from the datastore specified by ds
. Otherwise, it returns logical 0
(false
).
Examples
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
Output Arguments
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 logical0
(false
).
Version History
Introduced in R2017b