Problem's variable used by workers
1 次查看(过去 30 天)
显示 更早的评论
I'm seeing documentation of parfor loop and i'm reading that i can't use global and persistent variables in parfor loop, so how i can share a "problem's variable" between workers? In my code there is a parfor loop that call some function, in this function that call other function (etc, etc) i need to read a "problem's variable", how i can do it without global and without pass variable between all function call? For exemple:
parfor i = 1:size(...)
var = function1()
end
function result = function1()
var2 = function2()
end
function result = function2()
global varsProblems;
%something else
end
3 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!