User`s guide

5 Math with Codistributed Arrays
5-12
where D is any MATLAB array.
Determining the Dimension of Distribution
The codistributor object determines how an array is partitioned and its dimension
of distribution. To access the codistributor of an array, use the getCodistributor
function. This returns two properties, Dimension and Partition:
spmd, getCodistributor(X), end
Dimension: 2
Partition: [20 20 20 20]
The Dimension value of 2 means the array X is distributed by columns (dimension 2);
and the Partition value of [20 20 20 20] means that twenty columns reside on each
of the four workers.
To get these properties programmatically, return the output of getCodistributor to a
variable, then use dot notation to access each property:
spmd
C = getCodistributor(X);
part = C.Partition
dim = C.Dimension
end
Other Array Functions
Other functions that provide information about standard arrays also work on
codistributed arrays and use the same syntax.
length — Returns the length of a specific dimension.
ndims — Returns the number of dimensions.
numel — Returns the number of elements in the array.
size — Returns the size of each dimension.
is* — Many functions that have names beginning with 'is', such as ischar and
issparse.
Changing the Dimension of Distribution
When constructing an array, you distribute the parts of the array along one of the array's
dimensions. You can change the direction of this distribution on an existing array using
the redistribute function with a different codistributor object.