hasNextBlock
Syntax
Description
Examples
Check If Blocked File-Set Has Another Block
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 = 1x4 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: 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 = 1x1 BlockInfo Filename FileSize Offset BlockSize _________________________________________________________________________________________________________________ ________ ______ _________ "/mathworks/devel/bat/filer/batfs2561-0/Bdoc24b.2679053/build/runnable/matlab/toolbox/matlab/demos/accidents.mat" 7343 0 7343
file = 1x1 BlockInfo Filename FileSize Offset BlockSize ______________________________________________________________________________ __________ ______ __________ "/tmp/Bdoc24b_2679053_4152201/tp4d6ddb87/matlab-ex12893120/airlineResults.mat" 1.5042e+05 0 1.5042e+05
file = 1x1 BlockInfo Filename FileSize Offset BlockSize ______________________________________________________________________________________________________________ ________ ______ _________ "/mathworks/devel/bat/filer/batfs2561-0/Bdoc24b.2679053/build/runnable/matlab/toolbox/matlab/demos/census.mat" 353 0 353
file = 1x1 BlockInfo Filename FileSize Offset BlockSize _____________________________________________________________________________________________________________ ________ ______ _________ "/mathworks/devel/bat/filer/batfs2561-0/Bdoc24b.2679053/build/runnable/matlab/toolbox/matlab/demos/earth.mat" 32522 0 32522
Input Arguments
bs
— Blocked file-set
matlab.io.datastore.BlockedFileSet
object
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
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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)