hasNextBlock
确定分块文件集是否有其他分块
说明
示例
检查分块文件集是否有其他分块可供处理,并以迭代方式读取数据。
为一组文件创建一个分块文件集 bs
。
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: {}
使用 hasNextBlock
和 nextblock
函数,一次读取一个分块的分块信息,同时分块仍保留在文件集中。
while hasNextBlock(bs) file = nextblock(bs) end
file = 1×1 BlockInfo Filename FileSize Offset BlockSize _________________________________________________________________________________________________________________ ________ ______ _________ "/mathworks/devel/bat/filer/batfs2566-0/Bdoc25a.2974004/build/runnable/matlab/toolbox/matlab/demos/accidents.mat" 7343 0 7343
file = 1×1 BlockInfo Filename FileSize Offset BlockSize ______________________________________________________________________________ __________ ______ __________ "/tmp/Bdoc25a_2974004_1180181/tp8682171b/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/Bdoc25a.2974004/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/Bdoc25a.2974004/build/runnable/matlab/toolbox/matlab/demos/earth.mat" 32522 0 32522
输入参数
分块文件集,指定为 matlab.io.datastore.BlockedFileSet
对象。要创建 BlockedFileSet
对象,请参阅 matlab.io.datastore.BlockedFileSet
。
示例: hasNextBlock(bs)
版本历史记录
在 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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)