文档帮助中心文档
本页的翻译已过时。点击此处可查看最新英文版本。
数据存储分区数
n = numpartitions(ds)
n = numpartitions(ds,pool)
示例
n = numpartitions(ds) 返回数据存储 ds 的默认分区数。
ds
n = numpartitions(ds,pool) 返回分区数量以便在 pool 指定的并行池上方并行处理数据存储访问。要对数据存储访问进行并行处理,必须安装 Parallel Computing Toolbox™。
pool
全部折叠
根据示例文件 mapredout.mat(mapreduce 函数的输出文件)创建一个数据存储。
mapredout.mat
mapreduce
ds = datastore('mapredout.mat');
获取默认数量的分区。
n = 1
默认情况下,ds 中仅有一个分区,因为它只包含一个小文件。
划分数据存储并返回与第一部分对应的数据存储。
subds = partition(ds,n,1);
读取 subds 中的数据。
subds
while hasdata(subds) data = read(subds); end
获取多个分区以便在当前平行池上方使数据存储访问平行化。您必须安装了 Parallel Computing Toolbox。
获取多个分区以便在当前平行池上方使数据存储访问平行化。
n = numpartitions(ds, gcp);
划分数据存储并读取每个部分中的数据。
parfor ii=1:n subds = partition(ds,n,ii); while hasdata(subds) data = read(subds); end end
输入数据存储。可以使用 datastore 函数根据您的数据创建数据存储对象。
datastore
并行池对象。
示例: gcp
gcp
datastore | partition
partition
您曾对此示例进行过修改。是否要打开带有您的编辑的示例?
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
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:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office