%% Partition Datastore into Default Number of Parts
% 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 for ds.

n = numpartitions(ds);

%
% Partition the datastore into the default number of partitions and return the datastore corresponding to the first partition.

subds = partition(ds,n,1);

%
% Read the data in subds.

while hasdata(subds)
	data = read(subds);
end

% Copyright 2012 The MathWorks, Inc.