Determine how many blocks or files have been read
p = progress(fs)
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.
p
fs
BlockedFileSet
FileSet
0
1
0.55
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/BR2020ad/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.
progress
p = 0.2500
File-set, specified as a BlockedFileSet or FileSetobject. To create a BlockedFileSet or FileSetobject, see matlab.io.datastore.BlockedFileSet and matlab.io.datastore.FileSet.
matlab.io.datastore.BlockedFileSet
matlab.io.datastore.FileSet
matlab.io.datastore.BlockedFileSet | matlab.io.datastore.FileSet
You have a modified version of this example. Do you want to open this example with your edits?