for (drange)
for
-loop over distributed range
Description
for
executesloopVar
= drange(range
);statements
; end;for
-loop iterations in parallel over a distributed range.
MATLAB®partitions the range specified byrange
across the workers in the parallel pool, using contiguous segments of approximately equal length. MATLAB then executes the loop body commands instatements
in afor
-loop over the specified range ofloopVar
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 useloopVar
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 thebreak
执行语句终止循环。