%% Read File Data in Signal Datastore
% Specify the path to the sample signals included with Signal Processing Toolbox™.

folder = fullfile(matlabroot,'toolbox','matlab','audiovideo');

% Create a signal datastore that points to the specified folder and set sample rate variable name to Fs. List the names of the MAT-files in the datastore. Use the extractAfter function to extract the names from the full path.

sds = signalDatastore(folder,'FileExtension','.mat','SampleRateVariableName','Fs');
c = extractAfter(sds.Files,'audiovideo\')

% While the signal datastore has unread files, read consecutive files from the datastore. Use the progress function to monitor the fraction of files read.

while hasdata(sds)
    [data,info] = read(sds);
    fprintf('Fraction of files read: %.2f\n',progress(sds))
end

% Print and inspect the info structure returned by the last call to the read function.

info

% Copyright 2019 The MathWorks, Inc.