hasPreviousFile
Syntax
Description
Examples
Check If File-Set Has Previous File
Check if a file-set has a previous file available to process.
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
Get information for the second file and move the internal pointer forward one file.
file2 = nextfile(fs)
file2 = 1x1 FileInfo Filename FileSize ______________________________________________________________________________ __________ "/tmp/Bdoc24b_2679053_4152201/tp4d6ddb87/matlab-ex56196164/airlineResults.mat" 1.5042e+05
Check to see if a previous file exists. In this case, the result is true
because a previous file exists.
tf = hasPreviousFile(fs)
tf = logical
1
Input Arguments
fs
— File-set
FileSet
object
File-set, specified as a FileSet
object. To create
a FileSet
object, see matlab.io.datastore.FileSet
.
Version History
Introduced in R2020a
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)