Clearing functions selectively, excluding ones with persistent vars
显示 更早的评论
Hi everyone,
I am having memory issues with version 7 (2004) and have to twist and twirl to get around it. I want to clear all the functions at some point, except ones that have persistent variables in them. I create an automatic list for those function names, and find the rest of the function names, but I cannot use the clear command to remove those functions from memory, due to type mismatch. Any ideas on this?
---> clear(setdiff(inmem,pers_fList)) % (pers_fList : function list to keep)
'setdiff' outputs cell array, which 'clear' does not accept. I can't convert it appropriately. Could there be a simple solution to this? Thanks !
采纳的回答
更多回答(1 个)
John Barber
2014-9-19
1 个投票
Another approach is to use the mlock function inside of the functions that you want to protect from being cleared. You can then call clear functions without having to worry about keeping a list.
类别
在 帮助中心 和 File Exchange 中查找有关 Common Operations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!