Main Content

readall

Read all audio files from datastore

Description

example

data = readall(ADS) reads all audio files from the datastore.

If all the data in the datastore does not fit in memory, then readall returns an error.

data = readall(ADS,UseParallel=TF) reads the data in parallel if TF is true (requires Parallel Computing Toolbox™).

Examples

collapse all

Specify the file path to the audio samples included with Audio Toolbox™. Create an audio datastore that points to the specified folder.

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

Read all the data in the datastore.

readall(ADS)
ans=35×1 cell array
    { 539648x1  double}
    { 320512x4  double}
    { 227497x1  double}
    {   8000x1  double}
    { 685056x1  double}
    { 882688x2  double}
    {  24000x1  double}
    { 175104x1  double}
    {1116288x2  double}
    {1215360x2  double}
    { 263304x16 double}
    { 100868x1  double}
    { 180224x1  double}
    {  32768x1  double}
    { 192150x1  double}
    { 100352x1  double}
      ⋮

Input Arguments

collapse all

Specify ADS as an audioDatastore object.

Read in parallel, specified as true or false. If you specify true, readall reads all data from the datastore using a pool of parallel workers (requires Parallel Computing Toolbox). For more information on parallel pools, see parpool (Parallel Computing Toolbox). Parallel reading may result in improved performance when reading data.

Example: readall(ds,UseParallel=true)

Output Arguments

collapse all

All files in the audio datastore, returned as a cell array where each cell corresponds to a file.

Version History

Introduced in R2018b