Contenido principal

readall

R2026b

Read all audio files from datastore

Description

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.

example

data = readall(ADS,UseParallel=parmode) reads the data in parallel if parmode is "on" or "auto" (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 = 39×1 cell array
    { 539648×1  double}
    { 320512×4  double}
    { 227497×1  double}
    {  48000×1  double}
    {   8000×1  double}
    { 685056×1  double}
    { 882688×2  double}
    {  24000×1  double}
    { 175104×1  double}
    {1116288×2  double}
    {1215360×2  double}
    { 263304×16 double}
    { 100868×1  double}
    { 180224×1  double}
    {  32768×1  double}
    { 192150×1  double}
      ⋮

Input Arguments

collapse all

Specify ADS as an audioDatastore object.

Option to read data in parallel, specified as one of these values:

  • "off" — Run in serial on the MATLAB® client.

  • "auto" — Use a parallel pool if one is open or if MATLAB can automatically create one. If a parallel pool is not available, run in serial on the MATLAB client.

  • "on" — Use a parallel pool if one is open or if MATLAB can automatically create one. If a parallel pool is not available, throw an error.

If you do not have a parallel pool open and automatic pool creation is enabled, MATLAB opens a pool using the default cluster profile. To use a parallel pool to run computations in MATLAB, you must have Parallel Computing Toolbox. For more information, see Run MATLAB Functions with Automatic Parallel Support (Parallel Computing Toolbox).

Before R2026b: To run in parallel, set UseParallel to true (1).

Example: readall(ds,UseParallel="auto")

Data Types: char | string

Output Arguments

collapse all

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

Extended Capabilities

expand all

Version History

Introduced in R2018b

expand all