User`s guide
distributed
11-67
distributed
Create distributed array from data in client workspace
Syntax
D = distributed(X)
Description
D = distributed(X) creates a distributed array from X. X is an array stored on the
MATLAB client workspace, and D is a distributed array stored in parts on the workers of
the open parallel pool.
Constructing a distributed array from local data this way is appropriate only if the
MATLAB client can store the entirety of X in its memory. To construct large distributed
arrays, use one of the constructor methods such as ones(___,'distributed'),
zeros(___,'distributed'), etc.
If the input argument is already a distributed array, the result is the same as the input.
Use gather to retrieve the distributed array elements from the pool back to an array in
the MATLAB workspace.
Tips
• A distributed array is created on the workers of the existing parallel pool. If no pool
exists, distributed will start a new parallel pool, unless the automatic starting
of pools is disabled in your parallel preferences. If there is no parallel pool and
distributed cannot start one, the result is the full array in the client workspace.
Examples
Create a small array and distribute it:
Nsmall = 50;