%% Create a Distributed Array from a Composite Array
% Start a parallel pool of workers and create a Composite array by using spmd.

p = parpool("local",4);
spmd
C = rand(3,labindex-1);
end
C

% To create a distributed array out of the Composite array, use the distributed function. For this example, distribute the entries along the second dimension.

d = distributed(C,2)
spmd
    d
end

% When you are finished with the computations, delete the parallel pool.

delete(p);

% Copyright 2019 The MathWorks, Inc.