%% 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

% Copyright 2012 The MathWorks, Inc.