hasNextFile
Determine if file-set has another file in file-set
Syntax
Description
Examples
Check if a file-set has another file and read the data iteratively.
Create a file-set fs for a collection of files.
folder = {'accidents.mat','airlineResults.mat','census.mat','earth.mat'}folder = 1×4 cell
{'accidents.mat'} {'airlineResults.mat'} {'census.mat'} {'earth.mat'}
fs = matlab.io.datastore.FileSet(folder)
fs =
FileSet with properties:
NumFiles: 4
NumFilesRead: 0
FileInfo: Show FileInfo for all 4 files
AlternateFileSystemRoots: {}
Use the hasNextFile and nextfile functions to read file information one file at a time while files remain in the set.
while hasNextFile(fs) file = nextfile(fs) end
file =
1×1 FileInfo
Filename FileSize
_________________________________________________________________________________________________________________ ________
"/mathworks/devel/bat/filer/batfs2566-0/Bdoc25b.2988451/build/runnable/matlab/toolbox/matlab/demos/accidents.mat" 7343
file =
1×1 FileInfo
Filename FileSize
______________________________________________________________________________ __________
"/tmp/Bdoc25b_2988451_1242027/tp0f1832b3/matlab-ex38449974/airlineResults.mat" 1.5042e+05
file =
1×1 FileInfo
Filename FileSize
______________________________________________________________________________________________________________ ________
"/mathworks/devel/bat/filer/batfs2566-0/Bdoc25b.2988451/build/runnable/matlab/toolbox/matlab/demos/census.mat" 353
file =
1×1 FileInfo
Filename FileSize
_____________________________________________________________________________________________________________ ________
"/mathworks/devel/bat/filer/batfs2566-0/Bdoc25b.2988451/build/runnable/matlab/toolbox/matlab/demos/earth.mat" 32522
Input Arguments
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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)