Reduction assignments, or reductions, are an exception to the rule that loop iterations must be independent. A reduction variable accumulates a value that depends on all the loop iterations together, but is independent of the iteration order. For a list of supported reduction variables see Reduction Variables.
You can perform the same reduction assignment multiple times
parfor-loop provided that you use the
same data type each time.
For example, in the following
be the same type.
parfor i = 1:10; X = X + u(i); X = X + v(i); end
Similarly, the following example is valid provided that
the same type.
parfor i=1:10 r = foo(r,u(i)); r = foo(r,v(i)); end