data = read(ADS) returns
audio extracted from the datastore. Each subsequent call to the read
function continues reading from the endpoint of the previous call.
While the audio datastore has unread files, read consecutive files from the datastore. Use progress to monitor the fraction of files read.
while hasdata(ADS)
data = read(ADS);
fprintf('Fraction of files read: %.2f\n',progress(ADS))
end
Fraction of files read: 0.03
Fraction of files read: 0.05
Fraction of files read: 0.08
Fraction of files read: 0.10
Fraction of files read: 0.13
Fraction of files read: 0.15
Fraction of files read: 0.18
Fraction of files read: 0.21
Fraction of files read: 0.23
Fraction of files read: 0.26
Fraction of files read: 0.28
Fraction of files read: 0.31
Fraction of files read: 0.33
Fraction of files read: 0.36
Fraction of files read: 0.38
Fraction of files read: 0.41
Fraction of files read: 0.44
Fraction of files read: 0.46
Fraction of files read: 0.49
Fraction of files read: 0.51
Fraction of files read: 0.54
Fraction of files read: 0.56
Fraction of files read: 0.59
Fraction of files read: 0.62
Fraction of files read: 0.64
Fraction of files read: 0.67
Fraction of files read: 0.69
Fraction of files read: 0.72
Fraction of files read: 0.74
Fraction of files read: 0.77
Fraction of files read: 0.79
Fraction of files read: 0.82
Fraction of files read: 0.85
Fraction of files read: 0.87
Fraction of files read: 0.90
Fraction of files read: 0.92
Fraction of files read: 0.95
Fraction of files read: 0.97
Fraction of files read: 1.00
Return Information About Data
Specify the file path to the audio samples you want to include in the
audio datastore. In this example, the samples are located on a local desktop. Create an
audio datastore that points to the specified folder.
When you read data from the datastore, you can additionally return information about
the data as a structure. The information structure contains the file name, any labels
associated with the file, and the sample rate of the file.
[data,info] = read(ADS);
info
info =
struct with fields:
SampleRate: 44100
FileName: 'C:\Users\audiouser\Desktop\Turbine-16-44p1-mono-22secs.wav'
Label: Desktop
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: United States.
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.