MATLAB 帮助中心
清除所有 MemoizedFunction 对象的缓存
MemoizedFunction
clearAllMemoizedCaches
clearAllMemoizedCaches 可清除所有 MemoizedFunction 对象的缓存。
示例
全部折叠
创建两个储存函数,并多次调用它们。
mf1 = memoize(@sin); mf2 = memoize(@cos); a = [mf1(0) mf1(pi/2) mf1(pi)]; b = mf2(pi/2);
查看储存函数对象的统计信息。
mf1.stats.Cache
ans = struct with fields: Inputs: {{1×1 cell} {1×1 cell} {1×1 cell}} Nargout: [1 1 1] Outputs: {{1×1 cell} {1×1 cell} {1×1 cell}} HitCount: [0 0 0] TotalHits: 0 TotalMisses: 3
mf2.stats.Cache
ans = struct with fields: Inputs: {{1×1 cell}} Nargout: 1 Outputs: {{1×1 cell}} HitCount: 0 TotalHits: 0 TotalMisses: 1
清除所有储存函数缓存,并再次查看统计信息。
clearAllMemoizedCaches mf1.stats.Cache
ans = struct with fields: Inputs: {} Nargout: [] Outputs: {} HitCount: [] TotalHits: 0 TotalMisses: 0
在 R2017a 中推出
memoize
clearCache
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处