The code uses a global variable in a parfor
loop. Because
parfor
loops run on several different machines
simultaneously, the global
workspace might not be the same on each machine.
Therefore, using a global variable in a parfor
loop could
have unpredictable or unexpected results.
Make local copies of the global variables that you want to use within the
parfor
loop before beginning the parfor
loop.