progress
Description
returns the fraction of files read in the datastore as a normalized value in the range
[0,1].fractionRead
= progress(sds
)
Examples
Read File Data in Signal Datastore
Specify the path to a set of audio signals included as MAT-files with MATLAB®.
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.
sds = signalDatastore(folder, ... FileExtension=".mat",SampleRateVariableName="Fs"); [~,c] = fileparts(sds.Files)
c = 7x1 cell
{'chirp' }
{'gong' }
{'handel' }
{'laughter'}
{'mtlb' }
{'splat' }
{'train' }
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
Fraction of files read: 0.14 Fraction of files read: 0.29 Fraction of files read: 0.43 Fraction of files read: 0.57 Fraction of files read: 0.71 Fraction of files read: 0.86 Fraction of files read: 1.00
Print and inspect the info
structure returned by the last call to the read
function.
info
info = struct with fields:
SampleRate: 8192
TimeVariableName: "Fs"
SignalVariableNames: "y"
FileName: "/mathworks/devel/bat/filer/batfs2566-0/Bdoc24b.2725827/build/runnable/matlab/toolbox/matlab/audiovideo/train.mat"
Input Arguments
sds
— Signal datastore
signalDatastore
object
Specify sds
as an signalDatastore
object.
Output Arguments
fractionRead
— Fraction of files read
normalized value in the range [0,1]
Fraction of files read, returned as a normalized value in the range [0,1].
Data Types: double
Version History
Introduced in R2020a
See Also
signalDatastore
| preview
| readall
| read
| hasdata
MATLAB Command
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: .
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.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)