hasdata

Return true if there is more data in datastore

Syntax

tf = hasdata(ADS)

Description

example

tf = hasdata(ADS) returns logical 1 (true) if there is data available to read from the datastore specified by ADS. Otherwise, it returns logical 0 (false).

Examples

collapse all

hasdata returns a logical scalar indicating whether or not there is unread data in the datastore. You can use audioDatastore to read files sequentially until all data is read.

Specify the file path to the audio samples included with Audio Toolbox™.

folder = fullfile(matlabroot,'toolbox','audio','samples');

Create an audio datastore that points to the specified folder.

ADS = audioDatastore(folder);

While the datastore has unread data, read from the datastore.

while hasdata(ADS)
    data = read(ADS);
end

Input Arguments

collapse all

Specify ADS as an audioDatastore object.

Output Arguments

collapse all

Indication is data is available to read from the datastore, returned as true or false.

Data Types: logical

Introduced in R2018b