Have you tried placing the body of the parfor loop into a function?
For example, instead of:
parfor i = 1:10
y(i) = x(i) * 10;
end
use:
parfor i = 1:10
y(i) = foo(i, x);
end
function y = foo(i, x);
y = x(i) * 10;
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!