Main Content

progress

Determine how many blocks or files have been read

Since R2020a

Description

p = progress(fs) returns the percentage of the data that you have read from a BlockedFileSet or FileSet object specified by fs. The percentage is a value between 0 and 1. For example, a return value of 0.55 means you have read 55% of the data.

example

Examples

collapse all

Determine the percentage of files that have been read from the file-set.

Create a file-set fs for a collection of files.

folder = {'accidents.mat','airlineResults.mat','census.mat','earth.mat'}
folder = 1x4 cell
    {'accidents.mat'}    {'airlineResults.mat'}    {'census.mat'}    {'earth.mat'}

fs = matlab.io.datastore.FileSet(folder)
fs = 
  FileSet with properties:

                    NumFiles: 4
                NumFilesRead: 0
                    FileInfo: FileInfo for all 4 files
    AlternateFileSystemRoots: {}

Get the information for the first file and move the internal pointer forward one file.

file1 = nextfile(fs)
file1 = 
  1x1 FileInfo
                                                        Filename                                                         FileSize
    _________________________________________________________________________________________________________________    ________

    "/mathworks/devel/bat/filer/batfs2561-0/Bdoc24b.2679053/build/runnable/matlab/toolbox/matlab/demos/accidents.mat"      7343  


Use the progress function to see the percentage of files that have been read from the file-set.

p = progress(fs)
p = 
0.2500

Input Arguments

collapse all

File-set, specified as a BlockedFileSet or FileSetobject. To create a BlockedFileSet or FileSetobject, see matlab.io.datastore.BlockedFileSet and matlab.io.datastore.FileSet.

Version History

Introduced in R2020a