www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/NumberofPartitionsExample.m

    %% Number of Partitions  

%% 
% Create a datastore from the sample file, |mapredout.mat|, which is the
% output file of the |mapreduce| function. 
ds = datastore('mapredout.mat');  

%% 
% Get the default number of partitions. 
N = numpartitions(ds) 

%%
% By default, there is only one partition in |ds| because it contains only
% one small file.  

%% 
% Partition the datastore and return the datastore corresponding to the
% first part. 
subds = partition(ds,N,1);  

%% 
% Read the data in |subds|. 
while hasdata(subds)
    data = read(subds);
end