globals and parfor
From the documentation on parfor: The body of a parfor-loop cannot contain global or persistent variable declarations. In the context of your problem, i.e., calling a function within the parfor that in turn references a global, this translates into: “parfor will probably not give expected or meaningful results”. This makes perfect sense. Consider the following … Read more