for (drange)
for
-loop over distributed range
Description
for
executes loopVar
= drange(range
); statements
; end;
for
-loop iterations in parallel over a distributed
range.
MATLAB® partitions the range specified by range
across the
workers in the parallel pool, using contiguous segments of approximately equal length.
MATLAB then executes the loop body commands in statements
in a
for
-loop over the specified range of loopVar
on each worker.
Each iteration must be independent of the other iterations, such that the iterations can be performed in any order. No communication with other workers is allowed within the loop body.
Each worker can access local portions of codistributed arrays, but cannot access
portions of codistributed arrays that are stored on other workers. You can use
loopVar
to index the local part of a codistributed array under the
following conditions:
loop index
range
is provided in the formrange = 1:N
the array is distributed using the default
1d
codistribution schemethe array has size
N
along the distribution dimension
You can use the break
statement to terminate the loop
execution.
Examples
Input Arguments
Version History
Introduced in R2007b