Return values in a parfor loop
显示 更早的评论
Heyhey,
at the moment my source code looks like this
ParForQueue = parallel.pool.DataQueue;
afterEach(ParForQueue,@AddStruct);
parfor m = 1:Anzahl
...
send(ParForQueue, Satz)
end
...
function [] = AddStruct(Satz)
global TabellenRueckgabe
...
end
My question is: how is it possible to avoid the global variable. I want to use the function like this instead of using global
function [TabellenRueckgabe] = AddStruct(Satz, TabellenRueckgabe)
TabellenRueckgabe(x) = Satz;
...
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Background Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!