The code refers to a parfor
loop index value after the loop has completed.
MATLAB performs the iterations in a parfor
loop in an
indeterminate order. For this reason, the loop index value is unavailable after
the loop terminates.
Rewrite the program so that the code following the loop does not depend on the loop index value. Use an ordinary variable rather than the loop index variable.