hasNextBlock
Determine if blocked file-set has another block
Syntax
Description
Examples
Check if a blocked file-set has another block available to process and read the data iteratively.
Create a blocked file-set bs
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'}
bs = matlab.io.datastore.BlockedFileSet(folder)
bs = BlockedFileSet with properties: NumBlocks: 4 NumBlocksRead: 0 BlockSize: 'file' BlockInfo: Show BlockInfo for all 4 blocks AlternateFileSystemRoots: {}
Use the hasNextBlock
and nextblock
functions to read block information one block at a time while blocks remain in the set.
while hasNextBlock(bs) file = nextblock(bs) end
file = 1×1 BlockInfo Filename FileSize Offset BlockSize _________________________________________________________________________________________________________________ ________ ______ _________ "/mathworks/devel/bat/filer/batfs2566-0/Bdoc25b.2988451/build/runnable/matlab/toolbox/matlab/demos/accidents.mat" 7343 0 7343
file = 1×1 BlockInfo Filename FileSize Offset BlockSize ______________________________________________________________________________ __________ ______ __________ "/tmp/Bdoc25b_2988451_1242027/tp0f1832b3/matlab-ex12893120/airlineResults.mat" 1.5042e+05 0 1.5042e+05
file = 1×1 BlockInfo Filename FileSize Offset BlockSize ______________________________________________________________________________________________________________ ________ ______ _________ "/mathworks/devel/bat/filer/batfs2566-0/Bdoc25b.2988451/build/runnable/matlab/toolbox/matlab/demos/census.mat" 353 0 353
file = 1×1 BlockInfo Filename FileSize Offset BlockSize _____________________________________________________________________________________________________________ ________ ______ _________ "/mathworks/devel/bat/filer/batfs2566-0/Bdoc25b.2988451/build/runnable/matlab/toolbox/matlab/demos/earth.mat" 32522 0 32522
Input Arguments
Blocked file-set, specified as a matlab.io.datastore.BlockedFileSet
object. To create a BlockedFileSet
object, see matlab.io.datastore.BlockedFileSet
.
Example: hasNextBlock(bs)
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)