progress

Determine how many blocks or files have been read

Description

example

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.

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
  Columns 1 through 3

    {'accidents.mat'}    {'airlineResults...'}    {'census.mat'}

  Column 4

    {'earth.mat'}

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

                    NumFiles: 4
                NumFilesRead: 0
                    FileInfo: Show 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/Bdoc20a/build/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.

Introduced in R2020a