Clear persistent variables of function on worker
6 次查看(过去 30 天)
显示 更早的评论
I need to clear the persistent variables of a function on all workers after having called it from a parallelized statement.
parfor n = 1 : N
persistentFunction()
end
spmd
clear persistentFunction
end
The above will not work because clear cannot be called from an spmd statement.
How can I clear persistentFunction ?
0 个评论
采纳的回答
更多回答(1 个)
Edric Ellis
2023-5-9
Whenever you issue a clear command at the client, the same clear command is issued on the workers. So you can simply do
clear persistentFunction
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!